KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having trouble with View.setSelected() . Views are flagged as selected -- TextViews , for example, change their font color -- but my background selectors don't seem to register the change. Example selector: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@android:color/transparent" /> <item android:state_selected="true"> <shape android:shape="rectangle"> <solid android:color="#ff8600" /> </shape> </item> </selector> I'm not even sure which kind of context information would be useful. The views are children of a LinearLayout, and I'm programatically setting the selected state inside a touch event. As I said, it does seem to work, since the font color goes from white to gray, but the background stays the same. Edit : I checked for silly mistakes before posting :P. The answer is not "add the android:background attribute".
Tags (comma-separated)
Save Edits
Cancel