How to load images from mipmap folder programmatically? [duplicate]

对着背影说爱祢 提交于 2019-12-21 07:12:34

问题


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.


回答1:


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);



回答2:


You can do

img.setImageResource(R.mipmap.imageid);


来源:https://stackoverflow.com/questions/30800708/how-to-load-images-from-mipmap-folder-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!