指定SRC我想显示的图像,根据的int imgch
显示的图像,而不在XML
这是我的onCreate值:
ImageView image = (ImageView)findViewById(R.id.gimage);
Resources res = getResources();
Drawable gameImage = res.getDrawable(images[imgch]);
在我的XML和这样的:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/gimage" />
如何让它在活动中显示正确的图像?
你可以使用Java代码设置图像 - setImageResource或Drawable。 – Eenvincible 2014-12-04 19:02:06
我用Drawable右键?我该怎么处理它? – 2014-12-04 19:03:22