画小圆点
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <size android:width="10dp" android:height="10dp"/> <solid android:color="#f00"/> </shape>初始化小圆点
//初始化小圆点 private void initshape() { //创建集合放小圆点图片 image = new ArrayList<>(); relative01.removeAllViews(); for (int i = 0;i < list.size();i++) { imageView = new ImageView(MainActivity.this); if (i == 0) { imageView.setImageResource(R.drawable.select_yes); }else { imageView.setImageResource(R.drawable.select_no); } //添加到集合 image.add(imageView); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(10,0,10,0); relative01.addView(imageView,layoutParams); } }