自定义小圆点
private void loaddot() {
dots = new ArrayList<ImageView>();
dots.clear();
for (int i = 0; i < urlpaths.length; i++) {
ImageView dot = new ImageView(this);
if (i == 0) {
dot.setImageResource(R.drawable.dot_focus);
} else {
dot.setImageResource(R.drawable.dot_normal);
}
LayoutParams params = new LayoutParams(20, 20);
params.setMargins(5, 0, 5, 0);
ll.addView(dot, params);
dots.add(dot);
}
}
制作小圆点
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp"/>
<solid android:color="#fff"/>
</shape>