flexbox-layout icon indicating copy to clipboard operation
flexbox-layout copied to clipboard

Items outside viewport cannot be accessed with D-Pad on Android TV

Open mrdezzods opened this issue 4 years ago • 0 comments

  • [x] I have searched existing issues and confirmed this is not a duplicate

Issues and steps to reproduce

FlexboxLayoutManager has an issue with D-Pad scrolling. When the grid is scrolled with swipe (tested on emulator), items outside the initial viewport are displayed and can be scrolled to, but when navigating down or up with d-pad, items which were not initially loaded are not accessible

To reproduce the issue, create a RecyclerView and set LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT) as layoutParams. Add FlexboxLayoutManager as its layout manager and add CardView as child presenter. Then add about 40 items in recyclersview's adapter.

Expected behavior

Viewport displays about 20 cards (5 columns, 4 rows). I expect it to scroll to items below when navigating with D-Pad

Version of the flexbox library

2.0.1

Link to code

val recyclerView = RecyclerView(parent.context, null).apply {
            layoutParams =
                ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
        }
recyclerView.layoutManager = FlexboxLayoutManager(parent.context)

mrdezzods avatar May 06 '21 08:05 mrdezzods