android - 当焦点在android TV中从一个行移动到另一个行时,有没有办法停止RowsSupportFragment中行的垂直移动?
问题描述
我一直试图停止 RowsSupportFragment 中的垂直移动。我有两行,我希望它们一直显示在固定位置。
在 android TV 中,只要焦点在 Rows 中垂直移动,下一行就会向上移动并离开其原始位置。我希望它垂直固定。
如果有什么办法可以帮我解决这个问题吗?
解决方案
你想保持焦点固定吗?
以下代码将使焦点位置固定到第一行:
// 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
推荐阅读
- java - 变量 id 可能尚未使用 lombok 初始化 Spring Boot Controller
- python - 仅打印查询
- angular - angular form control required 验证器仅在它们是表单输入时才有效
- putty - 使用 PuTTY 的 -m 参数在登录时运行脚本
- python - 将任何经过训练的模型存储在本地机器上,模型不一定是机器学习模型
- r - 如何在r中按组减去多列
- python - 在 Selenium Python 中选择下拉菜单
- c - 找到 BLE 扫描仪设备 0
- shopify - 在 Shopify 中为不同类型的客户发送不同的确认电子邮件(基本)
- android - 在 Flutter 中同时访问多个摄像头