权限
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
依赖
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.jcodecraeer:xrecyclerview:1.5.9'
api 'com.squareup.okhttp3:okhttp:3.9.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.google.code.gson:gson:2.8.2'
布局
mainactivity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.zld.kaoshiday10.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/left_list"
android:layout_width="100dp"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
<android.support.v7.widget.RecyclerView
android:id="@+id/right_list"
android:layout_marginLeft="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
text_item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:background="#fff"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- <ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/left_img"
/>-->
<TextView
android:id="@+id/left_title"
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/myimg"
android:layout_width="match_parent"
android:layout_height="60dp" />
<TextView
android:gravity="center"
android:id="@+id/mytitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</LinearLayout>
group_item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/item_list"
android:background="#fff"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
bean
CatagoryBean
package com.example.zld.kaoshiday10.bean;
import java.util.List;
/**
* Created by zld on 2018/4/20.
*/
public class CatagoryBean {
private String msg;
private String code;
private List<DataBean> data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* cid : 1
* createtime : 2017-10-10T19:41:39
* icon : http://120.27.23.105/images/category/shop.png
* ishome : 1
* name : 京东超市
*/
private int cid;
private String createtime;
private String icon;
private int ishome;
private String name;
public int getCid() {
return cid;
}
public void setCid(int cid) {
this.cid = cid;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public Str