This is my layout XML:
<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>
In application onCreate I hide both imageviews and then when necessary I show them. But when I do that, GLSurfaceView moves to the right for the width of the imageview.
This is because, you are using
LinearLayoutwithhorizontalorientation. When you make your imageViews visible, all your views from this viewGroup will try to fit horizontally. In this case if you want to make the position fix, useRelativeLayoutwithalignParentBottom = true