【发布时间】:2013-11-09 05:56:30
【问题描述】:
当我在 drawable 文件夹和子文件夹中有图像时,如何动态填充图像切换器 .. 比如 drawable-ldpi/S_001/a001_001.jpg。
我尝试填充一张图片,但应用程序崩溃了。 代码如下:
ImageSwitcher imageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher);
imageSwitcher.setImageDrawable(getResources().getDrawable(getResources().getIdentifier("S_001/a001_001.jpg", "drawable", getPackageName())));
我需要一些帮助。
【问题讨论】:
-
在drawable文件夹下新建文件夹不好。
-
所以你说我复制了可绘制文件夹中的所有图像文件。那么我怎样才能在一个数组中一次获取所有的 id 呢?
-
当我运行应用程序时,出现此错误“不幸的是,application1 已停止。”
标签: android android-drawable imageswitcher