Is it possible to add some Views above and between the rows in the RowsSupportFragment?
Asked
Active
Viewed 1,470 times
2
-
Have you checked this [SO post](https://stackoverflow.com/questions/22767439/fragment-intermediate-iidynmically-adding-row-in-a-fragment-android)? – Jessica Rodriguez Jan 21 '19 at 13:38
-
1Hi. My question is about specific RowsFragment of Leanback library for Android TV – Oleh Liskovych Jan 21 '19 at 14:05
1 Answers
3
It is possible to add any view above the rows by adding view to parent FrameLayout of VerticalGridView in onViewCreated method. To give space for this view, set proper value for verticalGridView.windowAlignmentOffsetPercent:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(view.parent as? FrameLayout)?.run {
val myView = LayoutInflater.from(context).inflate(R.layout.my_view_to_add, this, false)
addView(myView)
}
verticalGridView?.let {
it.windowAlignmentOffsetPercent = 30.0f
}
}
This added view is static and won't scroll out when focus goes down.
Between rows it seems there is no way to add anything but ItemDecorator, because VerticalGridView is a descendant of RecyclerView

Oleh Liskovych
- 991
- 3
- 13
- 31