//添加小圆点 ImageView point = new ImageView(getActivity()); point.setImageResource(R.drawable.selectr_ad); //LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(20, 20); layoutParams.leftMargin= 10; layoutParams.rightMargin = 10 ; list_xyd.add(point); ll_points.addView(point,layoutParams);
/***************************************************
@Override public void onPageSelected(int position) { position = position%list.size(); for (int i=0;i<list_xyd.size();i++){ if (i==position){ list_xyd.get(i).setSelected(true); }else{ list_xyd.get(i).setSelected(false); } } }
/********************************************************
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:width="10dp"
android:height="10dp"
/>
<solid
android:color="#fff"
/>
</shape>
<?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="wrap_content" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="220dp"> <com.bwei.Xmu.MyViewPager android:id="@+id/MyView_pager" android:layout_width="match_parent" android:layout_height="match_parent" /> <LinearLayout android:id="@+id/main_ll_points" android:layout_width="match_parent" android:layout_height="15dp" android:layout_alignParentBottom="true" android:gravity="center" android:orientation="horizontal"/> </RelativeLayout> </LinearLayout>