我使用AssetManager然后我在文件夹“assets / testAssets / img1.jpg,... img50.jpg”中有一系列名称图像。这里代码:
final AssetManager asmr = getAssets();
String[] filelist = asmr.list("testAssets");
我需要从该数组获取所有ID图像以使用另外一个函数中的代码:
`Drawable d = getResources().getDrawable(ID of image have index i);`
我可以获得ID以使用“Drawable”吗?如果我不能,我可以使用任何东西使用“Drawable”,我必须使用“Drawable”来做我的应用程序!太多了......
答案 0 :(得分:1)
Drawable d = Drawable.createFromStream(getAssets().open("folder/my_image.png"), null);