Android TV Leanback RowsFragment keep focused item at the start
If you also want the last item of the row to appear at the beginning, use this ListRowPresenter:
class FocusedItemAtStartListRowPresenter(focusZoomFactor: Int) : ListRowPresenter(focusZoomFactor) {
override fun createRowViewHolder(parent: ViewGroup): RowPresenter.ViewHolder {
val viewHolder = super.createRowViewHolder(parent)
with((viewHolder.view as ListRowView).gridView) {
windowAlignment = BaseGridView.WINDOW_ALIGN_LOW_EDGE
windowAlignmentOffsetPercent = 0f
windowAlignmentOffset = parent.resources.getDimensionPixelSize(R.dimen.lb_browse_padding_start)
itemAlignmentOffsetPercent = 0f
}
return viewHolder
}
}
This is similar to what the Leanback Launcher does.