zoukankan      html  css  js  c++  java
  • Banner实现无线轮播

    public class MainActivity extends AppCompatActivity {
    
        private List<String>list;
        private Banner banner;
    
        @Override
          protected void onCreate(Bundle savedInstanceState) {
                     super.onCreate(savedInstanceState);
                     setContentView(R.layout.activity_main);
                     banner = (Banner) findViewById(R.id.banner);
            banner.setImageLoader(new GlideBanner());
            list = new ArrayList<>();
            list.add("http:\/\/admin.haijin.com\/upload\/ad\/201709\/201709180932016684.png");
            list.add("http:\/\/admin.haijin.com\/upload\/ad\/201709\/201709180932155530.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929028807.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929028807.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929242328.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929322275.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929404607.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929484373.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180929579859.png");
            list.add("http:\/\/admin.haijin.com\/upload\/navbar\/201709\/201709180930169091.png");
            banner.setImages(list);
            banner.start();
        }
    
             }
    public class GlideBanner extends ImageLoader {
    
        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
            Glide.with(context).load(path).into(imageView);
        }
    }

    //添加

    compile 'com.youth.banner:banner:+'
    compile 'com.github.bumptech.glide:glide:4.0.0'

    权限

  • 相关阅读:
    Java 和因特网
    永久性
    在计算机编程中,一个基本的概念就是同时对多个任务加以控制
    违例控制:解决错误
    清除时的困境:由谁负责清除?
    集合库与方便使用集合
    单根结构
    集合与继承器
    对象的创建和存在时间
    抽象的基础类和接口
  • 原文地址:https://www.cnblogs.com/yu12/p/7652601.html
Copyright © 2011-2022 走看看