[英]Separate drawable folder for fetching images
I currently use this method:我目前使用这种方法:
activity.getResources().getIdentifier("pr" + Integer.toString(img_id), "drawable", activity.getPackageName()))
to get some images from the drawable folder.从可绘制文件夹中获取一些图像。 The problem is that I want to have a separate folder for images and to be able to use the same method but for example using profile_icons instead of drawable.
问题是我希望有一个单独的图像文件夹并能够使用相同的方法,但例如使用 profile_icons 而不是 drawable。
I tried creating a new Android Resource Directory with this name and it doesnt see the images.我尝试使用此名称创建一个新的 Android 资源目录,但它看不到图像。
Is there a method to create a separate folder which is seen by getResources().getIdentifier?有没有一种方法可以创建一个由 getResources().getIdentifier 看到的单独文件夹?
Thanks谢谢
Is there a method to create a separate folder which is seen by getResources().getIdentifier?
有没有一种方法可以创建一个由 getResources().getIdentifier 看到的单独文件夹?
No, sorry.不,对不起。 As the one comment suggests, use
assets/
for this.正如一条评论所暗示的,为此使用
assets/
。 Or, stick with your current prefix-based system (if I understand your code correctly).或者,坚持使用您当前的基于前缀的系统(如果我正确理解您的代码)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.