我想传递一个BrowseSupportFragment子类的RowsSupportFragment子类,因为我需要覆盖RowsSupportFragment中的一些方法来更改RowsSupportFragment的默认行为。
例如,要通过将setExpand()函数重写为true来始终显示行标题。
同样的问题适用于HeadersSupportFragment的子类。
没有测试过这个,但我相信它应该可行。
在你的BrowseSupportFragment
中,为你的子类创建一个自定义的FragmentFactory
并覆盖现有的ListRow配对,如下所示:
getMainFragmentRegistry().registerFragment(ListRow.class, new FragmentFactory<CustomRowsSupportFragment>() {
@Override
public CustomRowsSupportFragment createFragment(Object row) {
return new CustomRowsSupportFragment();
}
}
);