How to Set Focus to a TextView, using state_selected, in XML
added in API Level 1Sets focus to a TextView using XML
1. Add a TextView in your main.xml file.
2. In the main.xml file, add the code below.
<TextView
...
android:state_selected = "true"
/>
3. Compile and run!
Related Articles:
- setSelected(true) - Set Focus to a TextView, using Java
- requestFocus - Set Focus to a TextView, using requestFocus, in XML
http://developer.android.com/reference/android/R.attr.html#state_selected