Code: StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.HORIZONTAL); mRv.setLayoutManager(manager); mRv.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.HORIZONTAL_LIST), DividerItemDecoration.HORIZONTAL_LIST); mAdapter = new HomeAdapter(this, list); mRv.setAdapter(mAdapter);
Then recyclerview no adapter attached appears; skipping layout
And then check a variety of methods did not solve, a lot of online statements. But it still hasn’t solved the problem
StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.HORIZONTAL); mRv.setLayoutManager(manager); mAdapter = new HomeAdapter(this, list); mRv.setAdapter(mAdapter); mRv.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.HORIZONTAL_LIST), DividerItemDecoration.HORIZONTAL_LIST);
I saw an example later. The code for finding the split line is called
after setAdapter.
Then try it, and it’s OK