How to Make a TextView Clickable
android:clickable was added in API Level 1Defines whether the TextView reacts to click events.
When the TextView is clicked the Text will change color while pressing, to indicate it is being clicked.
(android:clickable has no effect on an EditText.)
1. Add a TextView in your main.xml file.
2. In the main.xml file, add the code below.
<TextView
...
android:clickable = "true"
/>
3. Compile and run!
Related Articles:
- android:textColorLink - Set the Color of Link Text (URLs) in a TextView/EditText
- android:linksClickable - Make Link Unclickable in a TextView/EditText
- android:autoLink - Have Clickable URL Link in TextView
http://developer.android.com/reference/android/view/View.html#attr_android:clickable
http://developer.android.com/reference/android/R.attr.html#clickable