1

这是我的 Androidlist_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 模拟器中显示时的样子:

在此处输入图像描述

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

4

1 回答 1

2

您是否尝试过不同的图像以查看该图像是否执行相同的操作?对我来说,它看起来像是在您的列表后面创建图像,RelativeLayout而您的 textview 背景位于顶部。由于您将其设置为填充行的宽度,我敢打赌,如果您只是设置为,wrap_content您会在后面看到它

尝试将图像作为TextView背景

于 2012-05-14T21:06:24.237 回答