这是我的布局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“将其改为垂直 –