我想用這樣的命令的ImageView的:負載從XML
ImageView image = (ImageView) findViewById(R.id.x2);
我應該在哪裏把文件main.xml
下面這段代碼?
<ImageView
android:id="@+id/x2"
android:src="@drawable/book"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
您在其中的setContentView設置活動的佈局XML(r.layout。) –