这是我的代码:
public class CespiteAdapter extends RecyclerView.Adapter<CespiteAdapter.ViewHolder>
{
private List<CespiteOgg> cespiteOggList;
private Context context;
public CespiteAdapter(List<CespiteOgg> cespiteOggList, Context context) {
this.cespiteOggList = cespiteOggList;
this.context = context;
}
public class ViewHolder extends RecyclerView.ViewHolder
{
public CardView cv;
public TextView txtNumInventario;
public TextView txtNomeCespite;
public TextView txtDtCatalogazione;
public TextView txtAula;
public TextView txtNomeUser;
ViewHolder(View itemView)
{
super (itemView);
//cv = (CardView) itemView.findViewById(R.id.cardView);
txtNumInventario = (TextView) itemView.findViewById(R.id.txtNumeroInventario);
txtNomeCespite = (TextView) itemView.findViewById(R.id.txtNomeCespite);
txtDtCatalogazione = (TextView) itemView.findViewById(R.id.txtDataCatalogazione);
txtAula = (TextView) itemView.findViewById(R.id.txtAula);
txtNomeUser= (TextView) itemView.findViewById(R.id.txtNomeUser);
}
}
@Override
public CespiteAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View cespiteView = inflater.inflate(R.layout.cespite_card_view, parent, false);
return new ViewHolder(cespiteView);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position)
{
CespiteOgg cespiteOgg = cespiteOggList.get(position);
holder.txtNumInventario.setText(cespiteOgg.getNumInventario());
holder.txtNomeCespite.setText(cespiteOgg.getNomeCespite());
holder.txtDtCatalogazione.setText(cespiteOgg.getDtCatalogazione());
holder.txtAula.setText(cespiteOgg.getAula());
holder.txtNomeUser.setText(cespiteOgg.getNomeUser());
}
@Override
public int getItemCount()
{
return cespiteOggList.size();
}
}
是否可以从图形中提取缓冲区,因为图片已经缩放,我想将它作为base64?
由于