【问题标题】:Is there a way to stop vertical movement of rows in RowsSupportFragment when the focus moves from one Row to another in android TV?当焦点在android TV中从一个行移动到另一个行时,有没有办法停止RowsSupportFragment中行的垂直移动?
【发布时间】:2019-05-15 05:12:07
【问题描述】:

我一直试图停止 RowsSupportFragment 中的垂直移动。我有两行,我希望它们一直显示在固定位置。

在 android TV 中,只要焦点在 Rows 中垂直移动,下一行就会向上移动并离开其原始位置。我希望它垂直固定。

如果有什么办法,请帮我解决这个问题?

【问题讨论】:

    标签: android android-tv leanback


    【解决方案1】:

    您要保持焦点固定吗?

    以下代码将焦点位置固定在第一行:

        // Item alignment affects focused row that isn't the last.
        getVerticalGridView().setItemAlignmentOffset(0);
        getVerticalGridView().setItemAlignmentOffsetPercent(0);
        // Push rows to the top.
        getVerticalGridView().setWindowAlignmentOffset(0);
        getVerticalGridView().setWindowAlignmentOffsetPercent(0);
    

    getVerticalGridView().setWindowAlignment(VerticalGridView.WINDOW_ALIGN_LOW_EDGE);

    查看以下链接了解更多详情: https://developer.android.com/reference/android/support/v17/leanback/widget/VerticalGridView

    【讨论】:

      猜你喜欢
      • 2020-02-08
      • 2021-08-30
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-05
      • 2012-02-29
      • 2020-06-22
      相关资源
      最近更新 更多