Android listview和带边距的textview中的背景颜色不同

Android listview和带边距的textview中的背景颜色不同,android,listview,textview,Android,Listview,Textview,我已设置此颜色: <color name="lightgrey">#1a000000</color> 和@drawable/rect <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/white"/> <corners an

我已设置此颜色:

<color name="lightgrey">#1a000000</color>
@drawable/rect

<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">

<solid android:color="@color/white"/>

<corners
        android:bottomLeftRadius="5dip"
        android:bottomRightRadius="5dip"
        android:topLeftRadius="5dip"
        android:topRightRadius="5dip"/>


检查列表项使用的布局,可能您使用的背景颜色与主布局的背景颜色不同

。。。请记住,在ListView标记上始终添加下一个属性,以避免滚动列表时出现黑色背景

android:cacheColorHint="#00000000" // setting transparent color

将背景颜色更改为适当的格式,如#e3(最多6个字符),因为android可能会忽略其余字符。将背景颜色更改为最多6个字符的颜色集,然后查看它是否有效。

否。我为listview的每一行充气的布局,颜色完全相同。是
@color/lightgrey
您能粘贴列表项所用的布局吗?您确定没有更改源代码中的背景颜色吗?可能的原因是颜色选择代码,请尝试另一种说法#e3,看看有什么区别,因为我不认为颜色选择中有超过6个字符是有效的,其余字符将自动跳过!试试看,或者发布你的列表xml代码。@Saqib这可能就是答案。将颜色更改为
#bdbdbd
,并正常工作。请给我答案,这样我才能把它标为正确答案
android:cacheColorHint="#00000000" // setting transparent color