這是我的佈局XML:Android的佈局 - 圖像查看推離
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_screen"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/back"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/bottleImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_margin="10dp"
android:src="@drawable/icon_food_milk" />
<ImageView
android:id="@+id/diaperImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_margin="10dp"
android:src="@drawable/icon_store_diaper" />
<android.opengl.GLSurfaceView
android:id="@+id/glview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="60dp"
android:windowIsTranslucent="true" />
</LinearLayout>
在實際應用中的onCreate我躲都imageviews,然後在必要時我告訴他們。但是當我這樣做時,GLSurfaceView將向右移動imageview的寬度。
試試這個:.... android:layout_gravity =「bottom |左「 – MAC
因爲你的父母android:orientation =」horizontal「將其改爲垂直 –