RecyclerView match_parent无效

使用RecyclerView 时,在xml文件中设置宽度match_parent无效,

1
2
3
4
5
6
7
@Override 
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//View view = View.inflate(parent.getContext(),R.layout.item_fra_main2, null);
View view = mInflater.from(mContext).inflate(R.layout.item_fra_main2, parent, false);
ViewHolder holder = new ViewHolder(view);
return holder;
}

注释掉的填充方式会导致match_parent无效