我试图了解RecyclerView,但无法理解Adapter和LayoutManager之间的区别。
谁能向我解释?
我正在使用 RecyclerView,但是当在 recyclerview 中查看项目时,这里只显示列表中的第一项是 RecyclerView Adapter
package com.example.abdelmagied.myapplication;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.ArrayList;
/**
* Created by AbdELMagied on 7/19/2017.
*/
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.MyViewHolder>{
private ArrayList<items> myitems;
public LayoutInflater inflater;
public RecyclerAdapter(Context context, ArrayList<items> myitems) {
this.myitems = myitems;
this.inflater = LayoutInflater.from(context);
}
@Override
public RecyclerAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = inflater.inflate(R.layout.recyclerviewrow , parent , false);
return new MyViewHolder(v);
}
@Override
public …Run Code Online (Sandbox Code Playgroud)