轮播banner(自带小圆点)

先导进去jar包
compile 'com.youth.banner:banner:1.4.9'
compile 'com.github.bumptech.glide:glide:3.7.0'


//这个类必须写

【轮播banner(自带小圆点)】public class ImageLoaderBanner extends ImageLoader {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
}
//主类
public class MainActivity extends AppCompatActivity {
private List list;
private Banner banner;
private String img1 = "http://img95.699pic.com/photo/50047/0111.jpg_wh300.jpg";
private String img2 = "http://img95.699pic.com/photo/50039/0266.jpg_wh300.jpg!/format/webp";
private String img3 = "http://img95.699pic.com/photo/50032/0608.jpg_wh300.jpg!/format/webp";
private String img4 = "http://img95.699pic.com/photo/50048/2213.jpg_wh300.jpg!/format/webp";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//初始化控件

banner = (Banner) findViewById(R.id.myBanner);
banner.setImageLoader(new ImageLoaderBanner());
//定义一个集合

list = new ArrayList();
list.add(img1);
list.add(img2);
list.add(img3);
list.add(img4);
banner.setImages(list);
//开始

banner.start();
}

}




android:id="@+id/myBanner"
android:layout_width="match_parent"
android:layout_height="200dp"
//布局文件中设置小圆点的大小

app:indicator_height="20dp"
app:indicator_width="20dp"

>






    推荐阅读