RecyclerView 条目布局宽度设置match_parent无效果的问题解决
这里为了解决recycleview不能撑满全屏的问题,这里layoutManager不管你布局里是否设置,都不准确,所以需要在代码里重新设置MATCH_PARENT
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()) {
@Override
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
};
recyclerView.setLayoutManager(layoutManager);