我的目標是顯示幾個按鈕,然後顯示一個PNG圖像。問題是圖像根本不顯示。如果我拿出所有按鈕,圖像將顯示。這個XML文件究竟有什麼問題?ImageView不顯示在LinearLayout中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:adjustViewBounds="true"
tools:context=".MainActivity" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/option1"
android:onClick="sendMessage" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/OR" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/option2"
android:onClick="sendMessage" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/Pic"
android:src="@drawable/soup" />
</LinearLayout>
默認情況下,Linearlayout的方向是水平的。使其垂直。 – Geros