android - 为什么我的 Android 列表项背景图像显示为深色覆盖?

标签 android android-layout android-theme

这是我的 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 图片:

enter image description here

但这是在 Android 模拟器中显示时的样子:

enter image description here

我可以看到正在应用背景,因为它有轻微的渐变效果,但我不知道这个黑色覆盖层是从哪里来的!

最佳答案

您是否尝试过使用不同的图像来查看该图像是否具有相同的效果?对我来说,它看起来像是在您的 RelativeLayout 列表后面创建图像,而您的 textview 背景在顶部。因为你将它设置为填充行的宽度,我敢打赌如果你只是设置为 wrap_content 你会在后面看到它

尝试将图像作为您的 TextView 背景

关于android - 为什么我的 Android 列表项背景图像显示为深色覆盖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10590897/

相关文章:

android - 如何混淆 Android 库模块

android - 量化密度如何影响图像资源选择和缩放?

android - 如何在带有硬件菜单按钮的设备上设置 Action Bar Overflow 的样式?

android - 自定义 <Key> 的外观

android - ScrollView 不显示顶部

android - 以编程方式创建的按钮不遵循主题的按钮样式

java - 提供 track drawable 来切换会弄乱外观

javascript - Cordova 闹钟

java - 为什么我的 JUnit 测试没有在 Eclipse 中运行?

android - 如何在android xml中绘制直角三角形