这是我的 Android list_item
布局 XML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="?android:attr/scrollbarSize"
android:background="@drawable/list_bg">
<TextView
android:id="@+id/tv_displayname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
这是 list_bg
图片:
但这是在 Android 模拟器中显示时的样子:
我可以看到正在应用背景,因为它有轻微的渐变效果,但我不知道这个黑色覆盖层是从哪里来的!
最佳答案
您是否尝试过使用不同的图像来查看该图像是否具有相同的效果?对我来说,它看起来像是在您的 RelativeLayout
列表后面创建图像,而您的 textview 背景在顶部。因为你将它设置为填充行的宽度,我敢打赌如果你只是设置为 wrap_content
你会在后面看到它
尝试将图像作为您的 TextView
背景
关于android - 为什么我的 Android 列表项背景图像显示为深色覆盖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10590897/