Android: rounded corner of a ListView hidden by a 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:

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

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

What am I doing wrong?

+3
source share
2 answers

I found a solution to the problem.

I used a parameter of android:cacheColorHintthe same color as for the ListView background, which caused the rounded corners to be hidden when scrolling through the list and after scrolling.

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

+4
source

, , ,

0

Source: https://habr.com/ru/post/1773638/


All Articles