xml中的写法
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_horizontal"
android:orientation="horizontal" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<View
android:id="@+id/vi1"
android:layout_width="29dp"
android:layout_height="10dp"
android:background="@drawable/xuanzhong" />
android:id="@+id/vi1"
android:layout_width="29dp"
android:layout_height="10dp"
android:background="@drawable/xuanzhong" />
<View android:id="@+id/vi2"
android:layout_width="29dp"
android:layout_marginLeft="5dp"
android:background="@drawable/weixuanzhong"
android:layout_marginRight="5dp"
android:layout_height="10dp"
/>
<View android:id="@+id/vi3"
android:background="@drawable/weixuanzhong"
android:layout_width="29dp"
android:layout_height="10dp"
/>
</LinearLayout>
</RelativeLayout>
android:layout_width="29dp"
android:layout_marginLeft="5dp"
android:background="@drawable/weixuanzhong"
android:layout_marginRight="5dp"
android:layout_height="10dp"
/>
<View android:id="@+id/vi3"
android:background="@drawable/weixuanzhong"
android:layout_width="29dp"
android:layout_height="10dp"
/>
</LinearLayout>
</RelativeLayout>
drawable文件夹中定义两个shape文件
未选中
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#f00"/>
<corners android:radius="5dp"/>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#f00"/>
<corners android:radius="5dp"/>
</shape>
选中
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#00f"/>
<corners android:radius="5dp"/>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#00f"/>
<corners android:radius="5dp"/>
</shape>