答案 0 :(得分:1)
在RecyclerView.ViewHolder
方法中将第一个参数从RecyclerView.ViewHolderRec
更改为onBindViewHolder
。
答案 1 :(得分:0)
ViewHolder:
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
public TextView mTextView;
public ViewHolder(TextView v) {
super(v);
mTextView = v;
}
}
RecyclerView.Adapter:
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
holder.mTextView.setText(mDataset[position]);
}