1. 程式人生 > >簡單解決RecyclerView巢狀的RecyclerView條目顯示不全和寬度不能鋪滿

簡單解決RecyclerView巢狀的RecyclerView條目顯示不全和寬度不能鋪滿

第一個RecyclerView的Adapter

@Override
    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.shop_item,null); 解決條目顯示不全
        MyHolder holder = new MyHolder(view);
        return holder;
    }

第二個RecyclerView的Adapter
 @Override
    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.check_item, parent,false);//解決寬度不能鋪滿
        MyHolder holder = new MyHolder(view);
        return holder;
    }