在我的应用程序中,我在 drawable 文件夹中有一些图像,服务器上使用了相同的图像。现在我从服务器获取了一个包含 9 个图像名称的数组,我必须解析该数组并从 drawable 文件夹中获取图像作为我们的数组从服务器获取并将图像显示到网格视图中。将获得任何帮助。
String imgName = "ic_launcher";
String uri = "drawable/" + imgName;
int icon = getResources().getIdentifier(uri, "drawable", getPackageName());
By this, you will get specific image from drawable folder. Iterate your array, and fetch all images from drawable folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.