添加底部圆点
一、方案一(通过自定义shape)
在布局中直接添加View对象,并设置background为未选中的shape。
布局:
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1" >
</android.support.v4.view.ViewPager>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dip"
android:layout_gravity="bottom"
android:gravity="center"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:gravity="center"
android:orientation="horizontal" >
<View
android:id="@+id/text1"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_weight="1"
android:background="@drawable/text_bg" />
<View
android:id="@+id/text2"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_weight="1"
android:background="@drawable/text_bg" />
<View
android:id="@+id/text3"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_weight="1"
android:background="@drawable/text_bg" />
<View
android:id="@+id/text4"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_weight="1"
android:background="@drawable/text_bg" />
</LinearLayout>
</LinearLayout>
</LinearLayout>