Hybris wrote: > On 17 Lug, 12:36, Mark Murphy <mmur...@commonsware.com> wrote: > >> If you do not like that option, you may wish to use a <selector> >> drawable XML file instead of a plain color, so you can specify different >> values for normal versus selected. > > this is the solution i'm exploring now after reading some past > messages but i cannot find a clear example on how to write the > selector and how to use it. > do you have any example about that?
Not specifically for a list row background color. However, here is a sample <selector> from the Android source code for EditText: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@drawable/editbox_background_focus_yellow" /> <item android:drawable="@drawable/editbox_background_normal" /> </selector> I would guess there is an android:state_selected="true" you could use to specify the drawable for the selected state. Save this file in res/drawable as yournamehere.xml and then reference it like any other drawable (e.g., R.drawable.yournamehere). Substitute in something appropriate for yournamehere, of course... -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---