问题
I see that the new honeycomb has a gallery sample. and it shows you how to change the color of the selected text view by adding
android:background="?android:attr/activatedBackgroundIndicator"
to your textview
However my row for the list is not only a text view but a collection of views under a linear layout .
To get the same behavior as the honeycomb gallery list selection i tired to set the background of this linear layout but it does not work. The selected row wont change color to blue.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background=" android:attr/activatedBackgroundIndicator">
<BUNCH OF OTHER VIEWS/>
</LinearLayout>
thanks in advanced.
回答1:
You forgot the ?
in the front of the android:background
attribute value.
Also note that activatedBackgroundIndicator
is only available in Android 3.0 and higher.
来源:https://stackoverflow.com/questions/5184511/activatedbackgroundindicator-on-layout-android-honeycomb