//导入依赖
implementation 'com.android.support:recyclerview-v7:28.0.0'
//首先在activity页面添加两个水平的RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="horizontal"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="100dp"
android:layout_height="match_parent"
android:id="@+id/recyr_left"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recy_right"/>
</LinearLayout>
//在MainActivity页面进行访问接口以及创建适配器的基本操作
package soexample.umeng.com.fenlei01;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import soexample.umeng.com.fenlei01.adapter.MyLeftAdapter;
import soexample.umeng.com.fenlei01.adapter.MyRightAdapter;
import soexample.umeng.com.fenlei01.bean.ShopLeftBean;
import soexample.umeng.com.fenlei01.bean.ShopRightBean;
import soexample.umeng.com.fenlei01.utils.OkHttpHelper;
public class MainActivity extends AppCompatActivity {
private RecyclerView recy_left;
private RecyclerView recy_right;
private List<ShopLeftBean.DataBean> leftbean = new ArrayList<>();
private MyLeftAdapter myLeftAdapter;
private int cid = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_main );
recy_left = findViewById( R.id.recyr_left );
recy_right = findViewById( R.id.recy_right );
LinearLayoutManager linearLayoutManager = new LinearLayoutManager