0

我有一个带有一堆单个文本视图项目的列表视图活动。这是我的项目:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:textColor="#FFFFFF"
    android:background="#00000000"
    android:padding="10dip"
    android:textSize="16dip"
    android:textStyle="bold" >    
</TextView>

如您所见,文本颜色为白色,背景为透明。(我尝试将 alpha 从 0 到 100,它显示白色背景或黑色)

现在在列表视图中,我在背景中放入了一个名为“s4”的图像:

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/llll"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:background="@drawable/s4">
</ListView>

我想让 listview 项目有点半透明,以便可以查看背景图像。

每个项目应该是半透明的,文本应该是白色和可见的,并且列表视图的背景应该是可见的。

我似乎做错了,我可以输入纯色,但我希望项目滚动到固定的背景图像上。

我究竟做错了什么?(有几个这样的问题,但都没有解决。)

编辑:

http://postimg.org/image/4yjh7fiwp/

这是屏幕截图,仔细看你可以看到文本,(尝试按 CTRL+A)但是文本的颜色不是问题,白色文本很好,因为我的背景图像是黑色的......我只想要列表视图,它是项目是半透明的。

屏幕截图与我所做的几乎相同,并且由swapnil给出的建议......根本没有变化。

4

1 回答 1

0

确保列表 backdrnd 不会变白,其他明智的文本将不可见。

<ListView
        android:id="@+id/lvSongs"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:cacheColorHint="@android:color/transparent"
        android:listSelector="@android:color/transparent"
        android:padding="10dp" 
        android:background="@drawable/s4"
/>

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:textColor="@android:color/white"
    android:background="@android:color/transpernt"
    android:padding="10dip"
    android:textSize="16dip"
    android:textStyle="bold" >    
</TextView>
于 2013-07-20T18:36:10.563 回答