This is my layout for an image capture program in android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<SurfaceView android:id="@+id/surface_camera"
android:layout_width="fill_parent" android:layout_height="420px">
</SurfaceView>
<RelativeLayout android:layout_width="fill_parent"
android:layout_alignParentBottom="true" android:id="@+id/beforeClick"
android:layout_height="wrap_content" android:background="@color/clickPanelBK"
android:paddingTop="6dp" android:paddingBottom="6dp">
<Button android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/capture_image_goback_btn"
android:background="@drawable/generalbutton" android:text="@string/back" />
<Button android:gravity="center"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/capture_image_btn"
android:background="@drawable/clickbutton" />
</RelativeLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_alignParentBottom="true" android:id="@+id/afterClick"
android:layout_height="wrap_content" android:background="@color/clickPanelBK"
android:paddingTop="6dp" android:paddingBottom="6dp">
<Button android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/img_retake"
android:background="@drawable/generalbutton" android:text="@string/retake" />
<Button android:gravity="center"
android:layout_alignParentRight="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/img_save"
android:text="@string/saveImg" android:background="@drawable/generalbutton" />
</RelativeLayout>
</RelativeLayout>
The last 2 relative layouts are swappable and are aligned fine. Only one of them appear at a time and is changed on a button click. Anyway, The problem here is, I have to mention the layout_height of surface view in px or dp. If I give layout_height as fill_parent, the view appears very small, 35% of width and height. Can anyone please give me a solution ?