Howdy UI Gurus! I am having an issue with a custom list selector. I tried to whittle the code down to a very small subset that runs independently of my project in hopes someone more familiar with the UI framework than I could assist. Basically, I have a custom selector I have been using for listviews in my application. It has 2 states, a gray gradient, and everything else. In the case of everything else, I want the view to be transparent. It worked fine and still does on the majority of platforms, however on ICS devices after the user touches and releases an item in the list there is an animation of an orange bar that fades in and away. I don't want this--but I'm not sure how to get rid of it. Are there new states now (or behavior?) in later versions of the OS? I'm not sure. Here is the code that demonstrates the issue on the emulator. It works as I'd like on Gingerbread devices, but not on ICS. I don't know about Honeycomb. Thanks in advance to anyone who posts a reply.
Cheers! main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#ffffff"> <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:dividerHeight="1dip" android:layout_gravity="center" android:background="@android:color/transparent" android:cacheColorHint="#0000" android:layout_margin="8dip" android:gravity="center" android:focusable="false"/> </LinearLayout> list_item.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="6dip" android:focusable="false" android:background="@layout/my_list"> <TextView android:id="@+id/label" android:layout_height="wrap_content" android:layout_width="fill_parent" android:textSize="16sp" android:textColor="#00ff00" android:padding="2dip"/> </LinearLayout> my_list.xml <selector xmlns:android="http://schemas.android.com/apk/res/ android"> <item android:state_pressed="true" android:drawable="@drawable/pressed" /> <item android:state_focused="true" android:drawable="@drawable/pressed" /> <item android:state_selected="true" android:drawable="@drawable/pressed" /> <item android:drawable="@android:color/transparent" /> </selector> pressed.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#3A3C39" android:endColor="#181818" android:angle="270"/> <corners android:radius="0dp" /> </shape> Main.java package com.authorwjf.grobble; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class Main extends ListActivity { private String[] mFruits = {"apple", "orange", "bannana", "pear", "kiwi", "grapes", "strawberry"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, mFruits)); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en