问题描述
如何将图片设置为来自网址的 ImageView ?使用Firebase身份验证,我可以获取已签名的照片网址在用户:
Uri uri = firebaseUser.getProviderData()。get(0).getPhotoUrl();
您可以使用Picasso Library在ImageView中显示图像。
您只需要将url,uri或资源传递给毕加索以图像浏览。
(/ *您的imageview id * /); pre> picasso.with(this).load(/ * url of image * /)。
要使用picasso,您需要在Gradle中添加以下内容:
compile'com.squareup.picasso:picasso:2.5.2'
阅读有关的文档
另外还有其他的库在ImageView中显示图像。
喜欢,等。
How can I set an image to a ImageView from a URL?
Using Firebase authentication, I get the photo URL of the signed in user:
Uri uri = firebaseUser.getProviderData().get(0).getPhotoUrl();
You can use Picasso Library to show images in ImageView.You just need to pass the url, uri or resource to Picasso with image view.
like
Picasso.with(this).load(/* url of image */).into(/*your imageview id*/);
To use the picasso you need to add the following in Gradle
compile 'com.squareup.picasso:picasso:2.5.2'
Read the documentation on http://square.github.io/picasso/
Also There are other libraries to display image in ImageView.Like Fresco, Glide, Universal Image Loader etc
这篇关于从照片网址设置ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!