Java Code Examples for androidx.recyclerview.widget.StaggeredGridLayoutManager#setGapStrategy()
The following examples show how to use
androidx.recyclerview.widget.StaggeredGridLayoutManager#setGapStrategy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoteListFragment.java From android-notepad with MIT License | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); if (folder != null) mToolbar.setTitle(folder.getName()); mToolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp); mToolbar.setNavigationOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ ((HomeActivity) getActivity()).mDrawerLayout.openDrawer(Gravity.LEFT); } }); StaggeredGridLayoutManager slm = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); slm.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS); mRecyclerView.setLayoutManager(slm); adapter = new Adapter(zeroNotesView, folder); mRecyclerView.setAdapter(adapter); adapter.loadFromDatabase(); }
Example 2
Source File: FragmentRecmdIllust.java From Pixiv-Shaft with MIT License | 5 votes |
@Override public void initRecyclerView() { StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); baseBind.recyclerView.setLayoutManager(layoutManager); baseBind.recyclerView.addItemDecoration(new SpacesItemWithHeadDecoration(DensityUtil.dp2px(8.0f))); }
Example 3
Source File: OverviewStaggeredGridFragment.java From Easy_xkcd with Apache License 2.0 | 5 votes |
@Override protected void setupAdapter() { StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); manager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); rv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); rvAdapter = new GridAdapter(); rv.setAdapter(rvAdapter); super.setupAdapter(); }
Example 4
Source File: RecyclerViewHelper.java From Mysplash with GNU Lesser General Public License v3.0 | 4 votes |
public static StaggeredGridLayoutManager getDefaultStaggeredGridLayoutManager(int column) { StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager( column, StaggeredGridLayoutManager.VERTICAL); layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); return layoutManager; }