Dynamically change the number of columns of a GridLayoutManager
问题 I am actually using a GridLayoutManager with two columns in my app and I would like to have one column depending on the view type used. Here is the code I have in the method "onCreateView()" of my fragment : // Recycler view for users usersList = (RecyclerView) mView.findViewById(R.id.usersList); // Layout manager (grid of users layoutManager = new GridLayoutManager(mContext, 2); usersList.setLayoutManager(layoutManager); // ArrayList of users users = new ArrayList<User>(); // Set the adapter