2

我已经创建了可扩展列表视图。我想创建圆形子行。我已经将最后一个子行创建为圆形。但是当我们展开和折叠可扩展列表视图时,圆形子行已经改变位置。如何处理这个问题.请建议我。

4

1 回答 1

2

首先为圆形矩形背景定义一个drawable,

round_rect_layout.xml

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <stroke android:width="1dp" android:color="#FF6363ff" />

<solid android:color="#10FFFF64" />
    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape>

然后你可以把这个drawable设置为你的子行的背景,

child_row.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/round_rect_layout"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/tvPlayerName"
            android:layout_width="match_parent"
            android:layout_height="30dip"
            android:gravity="center_vertical"
            android:paddingLeft="50dp" >
        </TextView>
    </LinearLayout>

</LinearLayout>
于 2013-01-17T09:38:40.790 回答