簡體   English   中英

Android ListView透明背景不起作用

[英]Android ListView transparent background not working

android:divider透明度不起作用。 設置顏色(例如#BBF232)工作正常。 使用“ @android:color / transparent”作為列表視圖背景也可以正常工作。 只是將其用作分隔線時,什么也不會發生。 有任何想法嗎 ?

我的XML ListView代碼:

    <ListView
    android:id="@+id/listView1"
    android:background="#FFFFFF"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/imageButton2"
    android:layout_below="@+id/imageButton1"
    tools:listitem="@android:layout/simple_list_item_2" 
    android:layout_alignParentRight="true"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="15dp"
    android:divider="@android:color/transparent"
    android:dividerHeight="10dp">

在listview內部使用此代碼:

        android:background="@android:color/transparent"
        android:cacheColorHint="@android:color/transparent"

如果您使用的是cardview,請使用以下代碼:

app:cardBackgroundColor="@android:color/transparent"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM