首先用到的依赖有
//okgo
implementation 'com.lzy.net:okgo:3.0.4'
implementation 'org.kie.modules:com-google-code-gson:6.5.0.Final'
//butterknife快速查找资源的依赖
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//Brvah:RecyclerView快速开发框架
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
///glide图片加载框架
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
//recyclerview依赖
implementation 'com.android.support:recyclerview-v7:28.0.0'
brvah使用需要在最外的gradle里面写入
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
清单文件下的网络权限
<uses-permission android:name="android.permission.INTERNET"/>
下面开始写布局
主布局
<android.support.v7.widget.RecyclerView
android:id="@+id/fl_recyle"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<android.support.v7.widget.RecyclerView
android:id="@+id/xq_recyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="7"
>
</android.support.v7.widget.RecyclerView>
分类的xml
<TextView
android:id="@+id/recy_text"
android:layout_margin="5dp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
/>
</