0m4r
0m4r

Reputation: 1035

Android: ListView rounded corner hidden by list item

I have this Listview element:

<ListView
android:id="@+id/category_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@drawable/list_background" 
android:layout_marginTop="10sp" 
android:layout_marginLeft="10sp" 
android:layout_marginRight="10sp"
android:drawSelectorOnTop="false"

android:listSelector="@drawable/list_item_background"           
android:cacheColorHint="#FFFFFF"            

android:clipToPadding="true"
android:focusable="true"
android:focusableInTouchMode="true"     
android:clickable="true"    
android:longClickable="true"

android:footerDividersEnabled="true"
android:headerDividersEnabled="true"
android:dividerHeight="1px"

/>

where list_background is:

<shape xmlns:android="http://schemas.android.com/apk/res/android">  
    <corners android:radius="10dp" /> 
    <solid android:color="#FFFFFF"/> 
</shape> 

The list view loads itself with the rounded corners, but then, the items of the list hide the round corners.

What am I doing wrong?

Upvotes: 3

Views: 3554

Answers (2)

0m4r
0m4r

Reputation: 1035

I have found the solution to the problem.

I was using the android:cacheColorHint setting the same color as I wanted to have for the ListView background, this was leading to have the rounded corners to be hid when the list was scrolling and after the scroll.

So, setting it to "transparent" (#0000) solved the issue!

Upvotes: 4

Marcovena
Marcovena

Reputation: 262

maybe you have to disable the single item's background in the list, make it transparent so that it doesn't overlay the list

Upvotes: 0

Related Questions