如何更改此ListView的背景颜色?

时间:2022-11-21 15:14:12

I have a ListView whose background is the following drawable (for rounded corner goodness):

我有一个ListView,其背景是以下drawable(圆角的优点):

    <?xml version="1.0" encoding="UTF-8"?> 
<item android:drawable="@color/white"> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shape="rectangle" 
        android:angle="90"
        android:color="#FFFFFF"> 

        <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
        android:topLeftRadius="7dp" android:topRightRadius="7dp"
        android:color="#FFFFFF"/> 
    </shape> 
</item>

The background is black however. How can I get it to be white?

然而背景是黑色的。我怎么才能让它成为白色?

1 个解决方案

#1


0  

In the xml where you have defined shape surround with this,

在你已定义形状环绕的xml中,

        
   < item android:drawable="@color/black">       
    shape code ...
   </item>

Define color value (black) in res/values/colors.xml

在res / values / colors.xml中定义颜色值(黑色)

update:

< selector  xmlns:android="http://schemas.android.com/apk/res/android">
< item android:drawable="@color/black""> 
    < shape 
        android:shape="rectangle" 
        android:angle="90"
        android:color="#FFFFFF"> 

       < corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
        android:topLeftRadius="7dp" android:topRightRadius="7dp"
        android:color="#FFFFFF"/> 
    </shape> 
</item>
</selector>

#1


0  

In the xml where you have defined shape surround with this,

在你已定义形状环绕的xml中,

        
   < item android:drawable="@color/black">       
    shape code ...
   </item>

Define color value (black) in res/values/colors.xml

在res / values / colors.xml中定义颜色值(黑色)

update:

< selector  xmlns:android="http://schemas.android.com/apk/res/android">
< item android:drawable="@color/black""> 
    < shape 
        android:shape="rectangle" 
        android:angle="90"
        android:color="#FFFFFF"> 

       < corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
        android:topLeftRadius="7dp" android:topRightRadius="7dp"
        android:color="#FFFFFF"/> 
    </shape> 
</item>
</selector>