item的布局,宽度设置了match_parent却还是好像wrap_parent那样
如下图所示:
把onCreateViewHolder里的这行改成下面那行即可:
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// View view = View.inflate(parent.getContext(), R.layout.item_recharge, null);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recharge, parent, false);
return new IncomeViewHodler(view, parent.getContext());
}