gpt4 book ai didi

android - 从 drawable 创建图库

转载 作者:行者123 更新时间:2023-11-30 01:00:26 24 4
gpt4 key购买 nike

我正在尝试创建显示可绘制图像的应用程序,例如图库应用程序。我正在使用本指南 link guide ,但我想显示来自可绘制资源的图像,而不是来自 SD 卡的图像。你能给我一些建议,我需要在这段代码中更改什么吗,我想我应该在 Utils.class 中进行更改。抱歉我的英语和我是新手android dev

最佳答案

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

稍后...根据位置像这样访问它们 myImageView.setImageResource(myimagelist[i]);

关于android - 从 drawable 创建图库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39515971/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com