How to load images from mipmap folder programmatic

2019-04-04 00:24发布

This question already has an answer here:

How to load images from the mipmap folder programmatically (as done with the drawables)?

  img.setImageResource(imageId);

I am using Android Studio 1.2.1.

2条回答
Evening l夕情丶
2楼-- · 2019-04-04 01:08

In Android Studio We have mipmap instead of drawable You Can Find Documents Related To Your Assets Here

You can use it Like

 img.setImageResource(R.mipmap.ic_launcher);
查看更多
Summer. ? 凉城
3楼-- · 2019-04-04 01:15

You can do

img.setImageResource(R.mipmap.imageid);
查看更多
登录 后发表回答