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);}