1.首先我们需要一个相对布局装一个线性布局的容器和一个白色的小点作为选中的标识,用灰点表示未选中的情况。
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="230dp"/>
<RelativeLayout
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
<View
android:id="@+id/v_guide_white_point"
android:layout_width="8dp"
android:layout_height="8dp"
android:background="@drawable/shape_point_white"/>
</RelativeLayout>
两种颜色的小点的xml文件如下,使用自定义shape。
shape_point_gray.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/darker_gray"/>
</shape>
shape_point_white.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/andr