【发布时间】:2021-09-27 14:17:58
【问题描述】:
我创建了一个colors.xml并有一个list_fragment.xml如下,listView的背景颜色没有变成蓝色?
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="orange">#ff5500</color>
<color name="transparent">#00000000</color>
<color name="black">#000000</color>
<color name="gray">#999999</color>
<color name="blue">#0066cc</color>
</resources>
list_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomePageListFragment">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue"
</ListView>
</LinearLayout>enter code here
谢谢, 乔
【问题讨论】:
-
您是否在列表中填充了非蓝色的项目?
-
嗨,布鲁斯,你用项目填充列表是什么意思?这个属性怎么设置?