我正在使用recyclerview通过Picasso更改img,但图像未更改。 我的适配器
@Override
public void onBindViewHolder(EmployeeViewHolder holder, int position) {
Context context = holder.imgCover.getContext();
holder.txtEmpName.setText(dataList.get(position).getName());
holder.txtEmpEmail.setText(dataList.get(position).getEmail());
holder.txtEmpPhone.setText(dataList.get(position).getPhone());
String replacedString = dataList.get(position).getGambar().replace("kk2019", "/");
Picasso.get().load("https://myurl.com/images.jpg").into(holder.imgCover);
}
然后
class EmployeeViewHolder extends RecyclerView.ViewHolder {
TextView txtEmpName, txtEmpEmail, txtEmpPhone;
ImageView imgCover;
EmployeeViewHolder(View itemView) {
super(itemView);
txtEmpName = (TextView) itemView.findViewById(R.id.txt_employee_name);
txtEmpEmail = (TextView) itemView.findViewById(R.id.txt_employee_email);
txtEmpPhone = (TextView) itemView.findViewById(R.id.txt_employee_phone);
imgCover = (ImageView) itemView.findViewById(R.id.img_cover);
}
}