本文整理汇总了Java中android.support.v17.leanback.widget.OnChildSelectedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnChildSelectedListener类的具体用法?Java OnChildSelectedListener怎么用?Java OnChildSelectedListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnChildSelectedListener类属于android.support.v17.leanback.widget包,在下文中一共展示了OnChildSelectedListener类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityCreated
import android.support.v17.leanback.widget.OnChildSelectedListener; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
customSetBackground(R.color.fastlane_background);
setHeaderAdapter();
setCustomPadding();
/**
* The setOnItemSelectedListener has been not only deprecated, but brutally removed by
* Google. To get around this limitation, I went to see how BaseRowFragment handled it.
* Turns out it sets a listener to the GridView (which is a RecyclerView): there you go.
*/
VerticalGridView gridView = ((MainActivity) getActivity()).getVerticalGridView(this);
gridView.setOnChildSelectedListener(new OnChildSelectedListener() {
@Override
public void onChildSelected(ViewGroup viewGroup, View view, int i, long l) {
Object obj = ((ListRow) getAdapter().get(i)).getAdapter().get(0);
getFragmentManager().beginTransaction().replace(R.id.rows_container, (Fragment) obj).commit();
((MainActivity) getActivity()).updateCurrentFragment((Fragment) obj);
}
});
}