0

我看到新蜂窝有一个画廊样品。它向您展示了如何通过添加来更改所选文本视图的颜色

android:background="?android:attr/activatedBackgroundIndicator"

到你的文本视图

但是,我的列表行不仅是文本视图,而且是线性布局下的视图集合。

为了获得与蜂窝画廊列表选择相同的行为,我厌倦了设置此线性布局的背景,但它不起作用。所选行不会将颜色更改为蓝色。

<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>

先谢谢了。

4

1 回答 1

6

您忘记了属性值?前面的。android:background

另请注意,activatedBackgroundIndicator仅在 Android 3.0 及更高版本中可用。

于 2011-03-11T15:37:35.063 回答