問題描述:
界面布局嵌套關(guān)系: ViewPager -> ScrollView -> FrameLayout -> RecyclerView
界面設(shè)置固定高度可滑動(dòng),自適應(yīng)的話無法滑動(dòng)?
解決方法:
對RecyclerView外層進(jìn)行RelativeLayout包裹
重寫LayoutManager 代碼設(shè)置自定義manager
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(getContext());?
?mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);?
?mRecyclerView.setLayoutManager(mLayoutManager);?
?// Disabled nested scrolling since Parent scrollview will scroll the content.?
?mRecyclerView.setNestedScrollingEnabled(false);?
?// specify an adapter (see also next example)?
?mAdapter = new SimpleListAdapter(DataSetProvider.generateDataset()); mRecyclerView.setAdapter(mAdapter);
重寫LayoutManager地址:?LayoutManager
此方法雖然解決滑動(dòng)問題,但是加載時(shí)item會一次性全部加載