MVP+Retrofit+RxJava进行网络数据的请求,Fresco进行图片的显示实现探探的左滑右滑效果。
先看一下效果
再看一下依赖
implementation project(':library')//关联一个 library
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.facebook.fresco:fresco:0.11.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
//若和观察者结合的话,需加上如下依赖:
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
下面进入代码部分
先是布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#cd4827">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="探索"
android:textColor="#fff"
android:textSize="17sp" />
<ImageView
android:id="@+id/notify_change"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="right|center_vertical"
android:padding="16dp"
android:src="@drawable/download" />
</FrameLayout>
<com.stone.card.library.CardSlidePanel
android:id="@+id/image_slide_panel"
android:layout_width="600dp"
android:layout_height="800dp"
card:bottomMarginTop="38dp"
card:itemMarginTop="10dp"
card:yOffsetStep="13dp" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools=