Android使用不同颜色行示例围绕完整列表视图的圆角

时间:2015-05-28 10:38:48

标签: android listview colors row rounded-corners

您好我正在尝试在具有不同列表视图行颜色的圆角中实现整个列表视图。

我能够在整个列表视图中实现圆角。但是,具有不同颜色的行无法适合圆角视图列表视图,特别是在列表视图的顶部和底部,因为它具有圆角。

请帮助解决此问题

1 个答案:

答案 0 :(得分:0)

ListView置于RelativeLayout

之内
<RelativeLayout
        android:id="@+id/rel_Bg"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/fragment_item_bg"
        android:padding="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp" >

        <ListView
            android:id="@+id/mListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="@null"
            android:dividerHeight="5dp"
            android:scrollingCache="true"
            android:smoothScrollbar="true" />
    </RelativeLayout>

<强> fragment_item_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <solid android:color="#04A3C3" />

    <corners android:radius="10dip" />
</shape>

根据您的要求更改边距,填充和颜色

如果在此代码之后,您的问题无法解决,请发送您的UI代码。