recyclerview-playground icon indicating copy to clipboard operation
recyclerview-playground copied to clipboard

FixedGridLayoutManager vertical scroll issue

Open rsatandroid opened this issue 7 years ago • 1 comments

Hi All, I was playing around FixedGridLayoutManager and tried to have a RecyclerView with FixedGridLayoutManager as an item of RecyclerView with LinearLayoutManager (Vertical).

The problem is now the RecyclerView with FixedGridLayoutManager does not scroll vertically. ViewHolder for parent RecyclerView with LinearLayoutManager is as follows -

public static class VerticalItemHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private SimpleTVAdapter mAdapter; private RecyclerView recyclerView; private TextView sectionTitle;

    public VerticalItemHolder(View itemView, SimpleTVAdapter adapter) {
        super(itemView);
        itemView.setOnClickListener(this);

        mAdapter = adapter;
        recyclerView = (RecyclerView) itemView.findViewById(R.id.tv_list);
        sectionTitle = (TextView) itemView.findViewById(R.id.sectionTitle);
    }

    @Override
    public void onClick(View v) {
        mAdapter.onItemHolderClick(this);
    }

    public void setSectionTitle(CharSequence text) {
        this.sectionTitle.setText(text);
    }

    public void setUpRecyclerViewItem(FixedGridLayoutManager manager,
                                      SimpleAdapter mAdapter, DividerDecoration dividerDecoration) {
        manager.setTotalColumnCount(10);
        recyclerView.setLayoutManager(manager);
        recyclerView.addItemDecoration(dividerDecoration);
        mAdapter.setItemCount(60);
        recyclerView.setAdapter(mAdapter);

    }
}

Can anyone point me in right direction how to achieve RecyclerView (FixedGrid) as an item inside another RecyclerView (Linear Vertical)?

Thank you.

rsatandroid avatar Jan 02 '17 09:01 rsatandroid

PS : FixedGridLayoutManager scrollVerticallyBy is not getting called while scrolling vertically.

is it possible that top LinearLayoutManager is consuming the scrollVerticallyBy ?

setNestedScrollingEnabled on parent RecyclerView is also not making any scrolling behaviour change.

rsatandroid avatar Jan 02 '17 10:01 rsatandroid