banner 无线轮播+小圆点

    private Banner banner;


    private List list;


    public final static String Ban[] = new String[]{
            "http://pic8.nipic.com/20100701/5290458_114840036316_2.jpg 


",//海
            "http://pic2.nipic.com/20090424/1468853_230119053_2.jpg 


",//亭子
            "http://img3.3lian.com/2013/s1/20/d/57.jpg 


",//白房子
            "http://pic39.nipic.com/20140226/18071023_164300608000_2.jpg 


",//华
            "http://a0.att.hudong.com/15/08/300218769736132194086202411_950.jpg 


"};//小路




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        banner = (Banner) findViewById(R.id.banner);
        list = new ArrayList<>();
        for (int i = 0; i < Ban.length; i++){
            list.add(Ban[i]);
        } 


//无限轮播
//设置加载样式
banner.setIndicatorGravity(Banner.CENTER);
banner.setBannerStyle(Banner.CIRCLE_INDICATOR_TITLE);
//是否自动轮播
banner.isAutoPlay(true);
//设置轮播的时间间隔
banner.setDelayTime(3000);
//设置加载的图片,解析出来的url
banner.setImages(list);


}
.添加banner依赖:compile 'com.youth.banner:banner:1.1.5' 




        android:id="@+id/bannar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

你可能感兴趣的:(banner 无线轮播+小圆点)