Android Leanback: Reduce rows spacing in RowsSupportFragment

Viewed 505

I'm trying to create a vertical list of selectable items in Android TV using Leanback RowsSupportFragment. There seems to be some default spacing, shown as black color in attachment, between rows here. I need to remove this spacing. I've looked into some dimens attributes but they are setting the spacing globally while I only require it on a particular screen. How this may be achieved?

enter image description here

1 Answers

Try using the setVerticalMargin (or setItemMargin ?) methods of the VerticalGridView widget in RowsSupportFragment:

getVerticalGridView().setVerticalMargin(25);
Related