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

前端 未结 3 1112
清酒与你
清酒与你 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:53

    For resource ids, you can use:

    Glide.with(fragment)
        .load(R.drawable.resource_id)
        .into(imageView);
    

    For assets, you can construct an asset uri:

    Glide.with(fragment)
        .load(Uri.parse("file:///android_asset/"))
        .into(imageView);
    

提交回复
热议问题