标签:
使用RecyclerView 时,在xml文件中设置宽度match_parent无效,发现在Adapter中要如下填充view(注释掉的填充方式会导致match_parent无效)
/** * 创建新View,被LayoutManager所调用 */ @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; }
RecyclerView android:layout_width="match_parent"无效
标签:
原文地址:http://my.oschina.net/yaly/blog/493627