Using Glide for Android, how do I load images from asset and resources?

前端 未结 3 1115
清酒与你
清酒与你 2020-12-08 05:55

I want to keep all the transformation, stoke and animations identical and was thinking if we can pass resource ID or asset name in Glide to load it locally?

3条回答
  •  臣服心动
    2020-12-08 06:50

    Glide
    .with(context)
    .load(uri)
    .asBitmap()
    .placeholder(R.drawable.yourimage)
    .error(R.drawable.yourimage)
    .into(yourview);
    

    Apart from the above answer if the image URL return null you can load default image into the view as like above.

提交回复
热议问题