private class ViewHolder extends RecyclerView.ViewHolder {
private TextView tv_name; public ViewHolder(View itemView) { super(itemView); tv_name = itemView.findViewById(R.id.tv_name); } } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof ViewHolder) { Bean bean = mlist.get(position); ((ViewHolder) holder).tv_name.setText(bean.getTdi_name()); } } 为什么我在ViewHolder类private声明的控件 能直接被.调用,有点无法理解,还望指教。
相关分类