Hi Mark, I also face a similar problem. I have a list view where i have text view and toggle buttons. Problem is in Touch mode when i touch the text view, no orange momentary orange highlight is happening and directly the dialogue associated with that text view touch is triggred.
It is confusing for user to know which item he selected. Can you please guide as what should be the selector look like as u said ""Make a <selector> be the background of a row, not the ListView. Have two > <selector> drawables, one per color scheme"" I guess selector currently for this is <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:drawable="@color/transparent" /> <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --> <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/ list_selector_background_disabled" /> <item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/ list_selector_background_disabled" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ list_selector_background_transition" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ list_selector_background_transition" /> <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" /> </selector> and xml file for views is like this..... <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" > <ImageView android:id="@+id/icon" android:layout_width="32dp" android:layout_height="32dp" android:layout_marginLeft="4sp" android:layout_marginRight="4sp" android:gravity="center_vertical" android:layout_marginTop="8sp" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical"> <TextView android:id="@+id/message" ================> for this text view the momentary orange highlight is not happening. android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6sp" android:gravity="center_vertical" android:textAppearance="?android:attr/ textAppearanceLargeInverse" /> <TextView android:id="@+id/status" android:layout_width="wrap_content" android:layout_height="26dip" android:textAppearance="?android:attr/ textAppearanceSmallInverse" android:singleLine="true" android:ellipsize="end" /> </LinearLayout> <ToggleButton android:id="@+id/button_toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="2sp" android:layout_marginRight="4sp" android:layout_marginTop="12sp" /> </LinearLayout> On Jul 17, 6:35 pm, Mark Murphy <mmur...@commonsware.com> wrote: > Hybris wrote: > > but even if i get this working then i'll have the problem of having > > the elements listed with alternated color because this selector is for > > the whole list and i do not see a way to change it's behaviour based > > on the position of the item. > > Make a <selector> be the background of a row, not the ListView. Have two > <selector> drawables, one per color scheme. > > -- > 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 -~----------~----~----~----~------~----~------~--~---