在 BrowseFragment 中禁用行缩放/扩展 [英] Disable row scaling / expand in BrowseFragment

查看:24
本文介绍了在 BrowseFragment 中禁用行缩放/扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有找到任何文档如何在将焦点从标题切换到浏览片段中的片段时禁用行缩放.

I have not found any documentation how to disable the row scaling when switching the focus from the Headers to the Fragments in a BrowseFragment.

Leanback 24.2.0 版

Leanback version 24.2.0

BrowseFragment 有一个函数 enableMainFragmentScaling 可以部分解决这个问题.图像现在具有完整尺寸,但标题仍然没有像在 PlayStore 应用程序、Youtube 应用程序中那样扩展.聚焦一行时的展开(无动画).

The BrowseFragment has a function enableMainFragmentScaling which solves the problem partially. The images now have the full size, but the titles are still not expanded like they are in the PlayStore App, Youtube app. The expand (without animation) when focusing a row.

到目前为止我做了什么:

What i did so far:

  • enableMainFragmentScaling(false); 在 BrowseFragment 中
  • setExpand(false); 在嵌套的 RowsFragments 中.但这并没有改变任何事情.
  • enableMainFragmentScaling(false); in BrowseFragment
  • setExpand(false); in the nested RowsFragments. But it didn't change anything.

该代码与演示的 Leanback 项目非常相似.但是在那里他们启用了行缩放.Github 上的演示

The Code is very similar to the demo leanback project. But there they have row scaling enabled. Demo on Github

推荐答案

我能够通过调用 setExpand(true) 作为我的 onCreateView()<的第一行来实现这种效果/code> 在我的 RowsFragment 中.

I was able to achieve this affect by calling setExpand(true) as the first line of my onCreateView() in my RowsFragment.

如果你想永远锁定这个效果,你可以在你的 RowsFragment 中覆盖 setExpand(...) 并调用 super.setExpand(true).我相信您仍然需要在 onCreateView() 中进行初始调用.

If you want to lock this effect forever, you can override setExpand(...) in your RowsFragment and just call super.setExpand(true). I believe you'll still need the initial call in onCreateView() though.

这篇关于在 BrowseFragment 中禁用行缩放/扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆