选择Drawable以编程方式在imageview上显示

时间:2012-10-26 16:05:38

标签: android view imageview

我已经说过想要包含在我的android项目资源中的N个图像,比如image0到imageN-1,我如何设置一个图像视图来显示其中一个drawables,当我只在运行时知道? / p>

类似的东西:

imageView.setImageDrawable(getResources().getDrawable("R.drawable.image"+i));

显然那不起作用,但你知道我的意思......

谢谢!

1 个答案:

答案 0 :(得分:2)

您可以在此博客中使用Resources.getIdentifier() explained