【发布时间】:2024-11-30 17:45:01
【问题描述】:
我有一个带有 listSelector 可绘制的 ListView 来指示所选项目。
<ListView
android:id="@+id/roadSignListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:listSelector="@drawable/listview" >
</ListView>
drawable/listview 是一个选择器:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/light_gray" />
</selector>
light_gray 在哪里
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:centerColor="#cccccc"
android:endColor="#cccccc"
android:startColor="#cccccc" />
</shape>
这是在答案in this question的帮助下完成的。
我的问题与另一个问题相同:背景悬在后面。我目前使用的提供的解决方案不起作用。直接使用颜色也是同样的问题
<ListView
android:id="@+id/roadSignListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:listSelector="#cccccc" >
</ListView>
我已将所需的最低 API 级别设置为 14,我的目标是最新的 19。我正在运行 Android 4.4.2 的新 Nexus 7 上进行测试。
接下来我应该尝试什么?
【问题讨论】:
标签: android listview android-listview android-drawable