指定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