Rounded corners become edgy when scrolling listview
I have a ListView
in my Android app. The items have rounded corners defined like this:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding android:left="15dp" android:top="15dp" android:right="15dp"
android:bottom="15dp" />
<sol开发者_如何转开发id android:color="@color/item_background" />
<corners android:radius="1dp" android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp" android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>
When the ListView
is displayed everything looks fine. But as soon as I start scrolling, the rounded corners get edgy and as soon as the scrolling stops they become rounded again.
Any ideas?
Try to set XML attribute android:scrollingCache="false" in your ListView. If it won't help try also android:cacheColorHint="#00000000"
This happened to me because my ListView had android:layout_height="0dp"
,
switch it to android:layout_height="match_parent"
精彩评论