【发布时间】:2019-08-28 02:56:02
【问题描述】:
我想传递一个 BrowseSupportFragment 子类的 RowsSupportFragment 子类,因为我需要重写 RowsSupportFragment 中的一些方法来改变 RowsSupportFragment 的默认行为。
例如,通过将 setExpand() 函数重写为 true 来始终显示行标题。
同样的问题也适用于 HeadersSupportFragment 的子类。
【问题讨论】:
-
到目前为止你尝试了什么?
-
不多,因为据我所知,没有办法覆盖 RowsSupportFragment 类并将其传递给 BrowseSupportFragment 的子类。 RowsSupportFragment 实例由工厂在 BrowseSupportFragment 中创建,成员是私有的,内部类是最终的。 Leanback 框架本身会创建 RowsSupportFragment 和 HeadersSupportFragment 的实例,并且不会为您提供覆盖这些类并将它们传递给子类 BrowseSupportFragment 的选项。您只能编辑演示者,但不能更改默认行为。
标签: kotlin android-tv leanback