GithubHelp home page GithubHelp logo

bannerview's Introduction

BannerView 安卓轮播图无限轮播实现

##实现无限轮播,基于纯代码实现,只需要将java文件 放入项目,就可以直接使用

image

##使用方法:

BannerView adView = (BannerView) findViewById(R.id.ad);

List strings = new ArrayList<>();

strings.add("http://pic74.nipic.com/file/20150813/10634318_132510392000_2.jpg");

strings.add("http://pic33.nipic.com/20130914/3267219_115451422382_2.jpg");

strings.add("http://pic36.nipic.com/20131213/7755667_223712251391_2.jpg");

strings.add("http://pic81.nipic.com/file/20151028/22036204_104827200000_2.jpg");

strings.add("http://pic67.nipic.com/file/20150515/12973503_100930685000_2.jpg");

adView.addUrl(strings);//设置显示图片地址

  List titles = new ArrayList<>();

titles.add("0000");

titles.add("111");

titles.add("22222");

titles.add("33333");

titles.add("44444");

titles.add("5555");

titles.add("6666666666666666");

titles.add("777777777777777777");

  adView.addTitles(titles);// 设置显示 标题

adView.setTextSize(16.0f,Color.GREEN);//设置文本字体大小和颜色

  adView.setTextGravity(BannerView.Gravity.CENTER);// 设置文本对齐方式

  adView.setIndicatorGravity(BannerView.Gravity.RIGHT);//设置圆点对齐方式

adView.setIndicatorColor(Color.RED,Color.BLUE);//圆点指引器颜色

adView.setDefulatTime(2000);//设置自动切换间隔时间

  adView.setFooterBackGround(Color.parseColor("#6F6B6B6B"));//底部文字和 圆点背景颜色,默认没有设置

adView.setImageViewLoadLinstener(new BannerView.ImageViewLoad() { @Override public void ImageLoad(ImageView view, String url) {          //图片加载回调 Glide.with(MainActivity.this).load(url).error(R.mipmap.ad).dontAnimate().into(view); }

 @Override
 public void ImageClick(int index) {

     //点击事件回调 Log.e(TAG, "ImageClick: " + index); } });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.