1. 程式人生 > 其它 >recyclerview簡單實現橫向滑動

recyclerview簡單實現橫向滑動

技術標籤:安卓

網格佈局

	GridLayoutManager manager = new GridLayoutManager(getActivity(),5);//數字為行數或列數
	manager.setAutoMeasureEnabled(true);
	manager.setOrientation(LinearLayoutManager.HORIZONTAL);//設定為橫向滑動
	recyclerView.setLayoutManager(manager);

線性佈局1

	LinearLayoutManager layoutManager = new LinearLayoutManager
(getContext()); layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);//設定為橫向滑動 recyclerView.setLayoutManager(layoutManager);

線性佈局2

	recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));