Reputation: 3519
After upgrading into AndroidX i am getting this error "Must be one of: RecyclerView.HORIZONTAL, RecyclerView.VERTICAL" when i setting the LayoutManager
tournamentRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
Issue id: WrongConstant.
Inspection info:Ensures that when parameter in a method only allows a specific set of constants, calls obey those rules
Upvotes: 0
Views: 2589
Reputation: 2966
It seems you are trying to vertically place items in RecyclerView
which is the default behavior for LinearLayout
Change this
tournamentRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
to this
tournamentRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
Upvotes: 3
Reputation: 3519
As the warning suggests change LinearLayoutManager.VERTICAL
into RecyclerView.VERTICAL
it will work perfectly
for sample :
tournamentRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
Upvotes: 5