简体   繁体   English

从 drawable 创建图片库

[英]Create image gallery from drawable

I'm trying to create app that shows image from drawable, eg gallery application.我正在尝试创建显示可绘制图像的应用程序,例如画廊应用程序。 I`m using this guide link guide , but I want show images from drawable resources, not from SD card.我正在使用本指南链接指南,但我想显示来自可绘制资源的图像,而不是来自 SD 卡的图像。 Can you give me some advice what I need change in this code, I guess I should change in Utils.class.你能给我一些建议,我需要在这段代码中改变什么,我想我应该在 Utils.class 中改变。 Sorry for my English and Im newbie android dev抱歉我的英语和我是新手 android 开发者

Define the drawables in an array 
int[] myImageList = new int[]{R.drawable.thingOne,      R.drawable.thingTwo};

later... access them like this based on position myImageView.setImageResource(myimagelist[i]);稍后...根据位置 myImageView.setImageResource(myimagelist[i]); 像这样访问它们;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM