I'm looking to implement Button to switch the Recycle view inbetween horizontal and vertical layout. If Recycleview is originally in Vertical Position then change to Horizontal on Click of button and vice versa.
My Logic is
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//If Recycleview is in Horizontal then
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
//If Recycleview is in Vertical then
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
}
Thanks in advance.