How to Make Android TextView Text Selectable
https://www.viralandroid.com/2015/12/how-to-make-android-textview-text-selectable.html
Android TextView allows us to display text in android application. There are lots of TextView attributes provided by android for developers to make easier working with TextView. In this simple tip, I am going to show how to make android TextView text selectable (select and copy) using xml and java code.
Related:
Create Scrolling Text (Marquee) in Android TextView
Programmatically Align Android TextView in the Center of the Screen
How to Make Scrollable TextView in Android
To make text selectable in android using XML, you have to add a attribute in TextView called android:textIsSelectable="true". You can also do same thing using java code too and you have to add textView.setTextIsSelectable(true); in your java code.
Following example shows you to make android text selectable using XML attribute and java code.
res/layout/android_text_selectable.xml
src/ AndroidTextViewTextSelectable.java
Output:
Related:
Create Scrolling Text (Marquee) in Android TextView
Programmatically Align Android TextView in the Center of the Screen
How to Make Scrollable TextView in Android
To make text selectable in android using XML, you have to add a attribute in TextView called android:textIsSelectable="true". You can also do same thing using java code too and you have to add textView.setTextIsSelectable(true); in your java code.
Android Example: How to Make Android TextView Text Selectable
Following example shows you to make android text selectable using XML attribute and java code.
Make Android TextView Text Selectable Using XML Attribute
res/layout/android_text_selectable.xml
Make Android TextView Text Selectable Using Java Code
src/ AndroidTextViewTextSelectable.java
Output: