Reputation: 6888
I am writing a Camera App in which i want to show buttons at bottom while user view app in a Portrait View and want to show to right side, when use Landscape view
But in my app still i am getting buttons to right side, in both views (Portrait and Landscape)
activity_camera.xml:-
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash_background" >
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/btnView" />
<TextView
android:id="@+id/angel_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
android:layout_toRightOf="@+id/camera_preview"
android:maxLines="1"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="@+id/btnView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="@drawable/gallery" />
<Button
android:id="@+id/btnCapture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/camera_preview"
android:background="@drawable/capture" />
</RelativeLayout>
Upvotes: 0
Views: 535
Reputation: 23655
You have to provide two different layout files, one for portrait and one for landscape.
Specifically, you should put your portrait layout xml into res/layout and your landscape layout xml into res/layout-land. Note, that both files must have the same name.
See http://developer.android.com/guide/practices/screens_support.html for further information.
Upvotes: 1