本文整理了Java中android.support.v7.widget.GridLayoutManager.scrollToPosition()
方法的一些代码示例,展示了GridLayoutManager.scrollToPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.scrollToPosition()
方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:scrollToPosition
暂无
代码示例来源:origin: architjn/MaterialIconPackTemplate
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.icon_fragment, container, false);
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int numOfRows = (int) (size.x / getResources().getDimension(R.dimen.size_of_grid_item));
RecyclerView gridview = (RecyclerView) view.findViewById(R.id.icons_rv);
GridLayoutManager layoutManager = new GridLayoutManager(view.getContext(), numOfRows);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.scrollToPosition(0);
gridview.setLayoutManager(layoutManager);
gridview.setHasFixedSize(true);
gridview.addItemDecoration(new SpacesItemDecoration(10, 5));
gridview.setAdapter(new IconsAdapter(view.getContext(),
getArguments().getInt("iconsArrayId", 0)));
return view;
}
代码示例来源:origin: YancyYe/GalleryPick
@Override
public void onClick(FolderInfo folderInfo) {
if (folderInfo == null) {
getSupportLoaderManager().restartLoader(LOADER_ALL, null, mLoaderCallback);
tvGalleryFolder.setText(R.string.gallery_all_folder);
} else {
photoInfoList.clear();
photoInfoList.addAll(folderInfo.photoInfoList);
photoAdapter.notifyDataSetChanged();
tvGalleryFolder.setText(folderInfo.name);
}
folderListPopupWindow.dismiss();
gridLayoutManager.scrollToPosition(0);
}
});
代码示例来源:origin: architjn/MaterialIconPackTemplate
GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.scrollToPosition(0);
gridview.setLayoutManager(layoutManager);
gridview.setHasFixedSize(true);
内容来源于网络,如有侵权,请联系作者删除!