I have an activity which is set up in the landscape mode and must remain this way(!So as an answer to my question don’t tell me to set my activity in the PORTRAIT mode cause this is not a solution).
And I wanna put a button at the bottom of the screen like this:
http://i52.tinypic.com/30n9o5t.png
but I just can do it.All my attempts got me only this:
http://i53.tinypic.com/54acjs.png
Here is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
>
<SurfaceView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/surface_camera"
/>
<Button android:id="@+id/btnPhoto"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Take Photo !!"></Button>
</FrameLayout>
Don’t forget my activity is in LANDSCAPE mode.
Thank you!
The trick is done using
layout_weightwhich is telling the layout to use all free space available. So you are creating two layouts the second with fixed height and the tell the first to use all the free space. This solution will work in both cases Landscape and Portrait mode.UPDATE