RecyclerView 不能填充满屏幕宽度

RecyclerView 的 Adapter 在使用是,一定要

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(MyApp.mContext)
            .inflate(R.layout.your_layout, parent, false);
    return new YourViewHolder(view);
}

像上面这样,使用

LayoutInflater.from(mContext).inflate(R.layout.your_layout, parent, false);

 

这样的方式填充布局。

如果使用:

View.inflate(mContext, R.layout.your_layout,parent)

会出现布局宽度填充不满的情况。