简体   繁体   中英

Android ListView transparent background not working

android:divider transparency is not working. Setting a color (eg #BBF232) is working fine. Using "@android:color/transparent" as listview background is working properly aswell. Just when using it as divider nothing happens. Any Ideas ?

My XML ListView Code:

    <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">

Inside listview use this code:

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

If you are using cardview then use the following code:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM