轮播组件

AUBannerView 轮播组件用于实现图片轮播效果。

效果图

默认提供白底的 AUTitleBar 控件:

代码示例

        BannerView bannerView = new BannerView(this, 1000);
        layout.addView(bannerView);

        List<BannerView.BannerItem> items = new ArrayList<BannerView.BannerItem>();
        items.add(new BannerView.BannerItem());
        items.add(new BannerView.BannerItem());
        items.add(new BannerView.BannerItem());
        final List<String> list = new ArrayList<String>();
        String color1 = "#111111";
        String color2 = "#666666";
        String color3 = "#eeeeee";
        list.add(color1);
        list.add(color2);
        list.add(color3);

        BannerView.BaseBannerPagerAdapter  adapter = new BannerView.BaseBannerPagerAdapter(bannerView,items) {
            @Override
            public View getView(ViewGroup container, int position) {
                TextView tv = new TextView(CarouselActivity.this);
                tv.setBackgroundColor(Color.parseColor(list.get(position)));
                container.addView(tv);
                return tv;
            }
        };

        bannerView.setAdapter(adapter);