我开发了一个购物应用程序,最终下单时我必须显示领域数据库中的所有购物车产品详细信息。在这里我可以获取除产品图片之外的所有细节和完美的工作。在这里我使用增强的 for 循环。我得到了准确的图像 URL,但 ImageView 不像 TextView 那样重复,请帮助我,我们将不胜感激。
void productname(){
pname = "";
pimage= "";
for (Cart cart : cartItems) {
pname = pname + cart.getName() + "!";
pname = pname.replaceAll("!", "\n\n");
pimage=pimage+Constants.getProductBaseUrlThumb(getContext()) + cart.getImage();
Glide.with(getContext())
.load(pimage)
.asBitmap()
.placeholder(R.drawable.placeholder)
.error(R.drawable.placeholder)
.into(ivProductImage);
}
最佳答案
当然它不会按预期工作,为此,请使用recycler view
或动态生成ImageView
。无法通过glide在一个ImageView中展示多张图片
关于java - 使用 Glide 使用 foreach 循环显示多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57177576/