It is usually necessary to modify the text color when textview is selected, which is always ineffective. The following methods can be implemented:
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:color="#FF111111"/> <!-- pressed --> <item android:state_focused="true" android:color="#FF222222"/> <!-- focused --> <item android:state_selected="true" android:color="#FF333333"/> <!-- selected --> <item android:state_active="true" android:color="#FF444444"/> <!-- active --> <item android:state_checkable="true" android:color="#FF555555"/> <!-- checkable --> <item android:state_checked="true" android:color="#FF666666"/> <!-- checked --> <item android:state_enabled="true" android:color="#FF777777"/> <!-- enabled --> <item android:state_window_focused="true" android:color="#FF888888"/> <!-- window_focused --></selector>
In textview, add the selector: Android: textcolor = "@ drawable/text_wbcolor_selector"
1. Click events can be added and set in the background, whether or not click events:
Textview. setonclicklistener (null );
2. Add Android: clickable = "true" Android: focusable = "true" to the parent control, and add Android: duplicateparentstate = "true" sub-control to obtain the Click Event of the parent control.
3. Set colorstatelist in the background code. This class can also be used.
4. Switch the color by clicking the event (a little effort ).
Textview selector gets focus in linearlayout