Android:从网络下载图像并设置为片段背景

带有图像链接,例如www.example.com/image.png,如何下载图像并将其设置为片段的背景?是否将imageview调整为内容容器的大小?如何将网络上的图像放置到imageview?

评论
  • fizzuas
    fizzuas 回复

    It can be an ImageView to match the fragment height/width and with the property android:scaleType="centerCrop". To download and show the image in that ImageView use Glide. Here is the official documentation.

    https://github.com/bumptech/glide