layoutManager=newLinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL,true);
RecycleView中item从下到上依次添加,并且第一个添加的item始终在最下面,新添加的item需要滑上去才能看到。 新增加的item需要上滑才能显示是导致miui截取长屏的时候出现截不全列表的情况的原因
改为:
layoutManager=newLinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, true); layoutManager.setStackFromEnd(true);
这样设置新添加的始终在顶部,之前添加的会被挤下去,从而解决问题。
其他设置说明:
layoutManager=newLinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
layoutManager=newLinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); layoutManager.setStackFromEnd(true);
这样子的话,先添加的item会被顶上去,最新添加的item每次都会显示在最下面