当前位置: 首页>>代码示例>>Java>>正文


Java OnChildSelectedListener类代码示例

本文整理汇总了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);
		}
	});

}
 
开发者ID:dextorer,项目名称:BuildingForAndroidTV,代码行数:26,代码来源:CustomHeadersFragment.java


注:本文中的android.support.v17.leanback.widget.OnChildSelectedListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。