我为一个 Activity 定义了一个主题,这里的背景颜色是#67b4ef。
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">100dip</item>
<item name="android:background">#67b4ef</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">20dip</item>
</style>
此 Activity 有一个应该为白色的 ListView ,我将其背景设置为:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:background="#ffffff">
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:divider="@null"
android:dividerHeight="0dip"
android:focusable="false"
android:focusableInTouchMode="false" >
</ListView>
</LinearLayout>
但 ListView 的颜色受主题背景颜色的影响。我不想要这个。
ListView :
lv=(ListView) findViewById(R.id.listView1);
最佳答案
这个问题的发生是因为你正在使用默认的安卓适配器 .....
使用自定义适配器并更改列表项颜色
使用此链接 Custom ListView
如果您卡在Custom ListView之间的任何地方,请在评论中提问。
享受编码......
关于android - 如果受主题颜色影响, ListView 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38842359/