activatedBackgroundIndicator on layout Android hon

2019-09-04 08:22发布

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条回答
2楼-- · 2019-09-04 08:56

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.

查看更多
登录 后发表回答