美文网首页
Android广告图片轮播控件,支持无限循环和多种主题,可以灵活

Android广告图片轮播控件,支持无限循环和多种主题,可以灵活

作者: 寒霜_c7dc | 来源:发表于2018-09-13 09:23 被阅读0次

    GitHub地址https://github.com/youth5201314/banner 目前star 6838

    1.添加依赖

    implementation'com.youth.banner:banner:1.4.10' //最新版本

    2.添加权限

    ```

    @Override

    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main2);

    ButterKnife.bind(this);

    }

    ```

    <pre>

    observable.subscribeOn(Schedulers.io())

    .observeOn(AndroidSchedulers.mainThread())

    .subscribe(new Consumer() {

    @Override

                public void accept(Test test)throws Exception {

    textView2.setText(test.getResults().toString());

    }

    });

    </pre>

    <code>

    observable.subscribeOn(Schedulers.io())

    .observeOn(AndroidSchedulers.mainThread())

    .subscribe(new Consumer() {

    @Override

                public void accept(Test test)throws Exception {

    textView2.setText(test.getResults().toString());

    }

    });

    </code>

    ```swift

    @OnClick(R.id.btn_rx)

    public void onViewClickedRx() {

    Retrofit retrofit =new Retrofit.Builder()

    .baseU

    rl("http://gank.io/")

    .addConverterFactory(GsonConverterFactory.create())

    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())

    .build();

    GankApi2 gankApi2 = retrofit.create(GankApi2.class);

    Observable observable = gankApi2.getDataRx("http://gank.io/api/data/Android/10/1");

    observable.subscribeOn(Schedulers.io())

    .observeOn(AndroidSchedulers.mainThread())

    .subscribe(new Consumer() {

    @Override

                    public void accept(Test test)throws Exception {

    textView2.setText(test.getResults().toString());

    }

    });

    }

    ```

    @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); ButterKnife.bind(this);}

    相关文章

      网友评论

          本文标题:Android广告图片轮播控件,支持无限循环和多种主题,可以灵活

          本文链接:https://www.haomeiwen.com/subject/azorgftx.html