I am trying to create a recycleview that works exactly like a Gallery view where when you are scrolling horizontally it will lock the current viewed item centraly like in a gallery view?
Is this possible?
So far I have created my recycleView and used a LinearLayoutManager set as Horizontal in order for it to scroll horizonally(works fine) but how do I lock the current item like in a gallery view?
recyclerView = (RecyclerView) view.findViewById(R.id.recycleView);
MyAdapter adapter = new MyMapAdapter();
recyclerView.setAdapter(adapter);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext(), LinearLayoutManager.HORIZONTAL, false);
recyclerView.setLayoutManager(mLayoutManager);
RecyclerView provides these built-in layout managers:
Source: https://developer.android.com/training/material/lists-cards.html#RecyclerView
GridLayoutManager:
GridLayoutManager mLayoutManager = new GridLayoutManager(this, 4); // (Context context, int spanCount)
mRecyclerView.setLayoutManager(mLayoutManager);
StaggeredGridLayoutManager:
StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL); // (int spanCount, int orientation)
mRecyclerView.setLayoutManager(mLayoutManager);