0

l

is there any way to remove start padding from RowsSupportFragment as shown in arrows

following style does not remove start padding.

<style name="SearchTheme" parent="@style/Theme.Leanback.Browse">
    <item name="rowHeaderDockStyle">@style/RowHeaderDock</item>
    <item name="rowHorizontalGridStyle">@style/HorizentalGridStyle</item>
</style>
<style name="RowHeaderDock">
    <item name="android:paddingStart">0dp</item>
</style>
<style name="HorizentalGridStyle" parent="Widget.Leanback.Row.HorizontalGridView">
    <item name="android:paddingStart">0dp</item>
</style>
1
  • How did you made the side nav menu? Is it implemented inside activity or fragment?
    – ibraizQ9
    Commented May 9, 2022 at 13:31

2 Answers 2

5

Add this statement to your dimens.xml:

<dimen name="lb_browse_padding_start">0dp</dimen>
0

using custome list row presenter

class CustomListRowPresenter : ListRowPresenter(FocusHighlight.ZOOM_FACTOR_NONE, true) {

override fun initializeRowViewHolder(holder: RowPresenter.ViewHolder) {
    super.initializeRowViewHolder(holder)
    val vh = (holder as ViewHolder)
    val mContainerViewHolder =
        (RowPresenter.ViewHolder::class.java).getDeclaredField("mContainerViewHolder")
    mContainerViewHolder.isAccessible = true
    val viewHolder = mContainerViewHolder.get(vh) as Presenter.ViewHolder
    val nonOverlappingLinearLayout =
        (viewHolder.view as ViewGroup).children.find { it is NonOverlappingLinearLayout }
    if (nonOverlappingLinearLayout != null) {
        val left = 0
        val right = nonOverlappingLinearLayout.right
        val top = nonOverlappingLinearLayout.top
        val bottom = nonOverlappingLinearLayout.bottom
        nonOverlappingLinearLayout.setPadding(left, top, right, bottom)
    }
    val headerHolder = vh.headerViewHolder
    headerHolder.selectLevel
    val field = vh::class.java.getDeclaredField("mPaddingLeft")
    field.isAccessible = true
    field.set(vh, 0)
}

}

1
  • how to add in fragment?
    – GvHarish
    Commented Jun 29, 2022 at 8:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.