有一个横向的顶部tab+viewpage布局显示的界面,然后在viewpage里面使用的Fragment的,每一个Fragment里面基本上都是RecycleView,写完了之后发现在ViewPage里面左右一直滑动,会导致Fragment里面的布局越来越小,一直查也没有找到原因,细看代码发现是给RecycleView添加了item间距导致
private void initRecycleView() {
WrapContentLinearLayoutManager linearLayoutManager = new WrapContentLinearLayoutManager(getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rlv.setLayoutManager(linearLayoutManager);
//下面这行代码会导致左右滑动的时候布局越来越小。。。
// rlv.addItemDecoration(new SpacesItemDecoration(20));
adapter = new SocialSecurityAdapter(getContext());
adapter.setData(data);
rlv.setAdapter(adapter);
————————————————–2017年11月27日14:57:04——————————————————