Disable row scaling / expand in BrowseFragment

白昼怎懂夜的黑 提交于 2019-12-01 06:06:46

问题


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 version 24.2.0

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); in BrowseFragment
  • setExpand(false); in the nested RowsFragments. But it didn't change anything.

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


回答1:


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

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.




回答2:


You should call to

enableRowScaling(false);

on the onActivityCreated method of your MainFragment.java class



来源:https://stackoverflow.com/questions/39508222/disable-row-scaling-expand-in-browsefragment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!