1

I have a VerticalGridView in which i plan to use multiple VerticalGridViews. Wrap_Content does nothing for a VerticalGridView if its set on it's height, The GridLayoutManager simply ignores it if the view is in a normal view, and it does match_parent it seems. If it is in another Vertical Scrolling view the height is 0. I cannot override the GridLayoutManager without duplicating the entire leanback library.

How can I achieve wrap_content for it?

1 Answers1

-2

setColumnWidth method can be used to achieve it:

gridView.setColumnWidth (ViewGroup.LayoutParams.WRAP_CONTENT)

In my case I extend VerticalGridView and call this method in constructor to make WRAP_CONTENT default behavior

Alexey Terekhov
  • 422
  • 4
  • 6
  • How can it work ? It applies to the width, not the height. In my case, unfortunately your solution did not work :( – Mackovich Feb 18 '22 at 17:35