开发者

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"           
an开发者_运维知识库droid: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?


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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜