做个备注记录:
一、动态添加小圆点:
其中
mData:为数据链表
<pre name="code" class="java">dots_id:为上级节点
<pre name="code" class="java">R.layout.dot_pull_new_item_s:为样式
private void setDots(ArrayList<PullProvinceListBean> mData,int arg0){ /** * 加viewPager底部点 * */ dots_id.removeAllViews(); for (int i = 0; i < mData.size(); i++) { if(i==arg0){ View dot = LayoutInflater.from(getApplicationContext()).inflate( R.layout.dot_pull_new_item_s, dots_id); }else{ View dot = LayoutInflater.from(getApplicationContext()) .inflate(R.layout.dot_pull_new_item, dots_id); } } }二、参数arg0
@Override public void onPageSelected(int arg0) { setDots(mData,arg0); }三、 dot_pull_new_item_s
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/dot_pn_item_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/dot_select" /> </LinearLayout>