[英]image not showing in networkimageview for first load
I have a NetworkImageView
which has to show image once I click a button. 我有一个
NetworkImageView
,单击按钮后必须显示图像。 When I click the button for the first time it doesn't display the image but if I click it second time then its showing the image. 当我第一次单击该按钮时,它不会显示图像,但是如果我第二次单击,则它会显示图像。
I have set default image for it and it shows that image for first click of button but if I click it again then it shows the image form the url. 我已经为其设置了默认图像,并且它在单击按钮时显示了该图像,但是如果再次单击它,它将显示来自url的图像。
ImageLoader imageLoader = mInstance.getImageLoader();
imageLoader.get(url, ImageLoader.getImageListener(img, R.drawable.placeholder, android.R.drawable.ic_dialog_alert));
img.setImageUrl(url, mInstance.getImageLoader());
Is the use of NetworkImageView mandatory? 是否必须使用NetworkImageView? If not, you should try using Picasso library: http://square.github.io/picasso/ .
如果没有,您应该尝试使用Picasso库: http : //square.github.io/picasso/ 。 It's super easy to use!
超级好用!
Answering your question using picasso: 使用毕加索回答您的问题:
You can use a normal ImageView, then, onClick you fetch the image you want, nad inflate your view with the following method: 您可以使用普通的ImageView,然后在onClick上提取所需的图像,然后使用以下方法将视图放大:
Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.