devunwired / recyclerview-playground

Examples of RecyclerView use and custom LayoutManager implementations
MIT License
1.25k stars 270 forks source link

FixedGridLayoutManager vertical scroll issue #29

Open rsatandroid opened 7 years ago

rsatandroid commented 7 years ago

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 commented 7 years ago

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.