tags:

views:

42

answers:

2

Hello I would like to make a layout like the one displayed on the this link. just an image and 2 simple buttons on the button of the screen, I am trying using this code:

<merge xmlns:android="http://schemas.android.com/apk/res/android"&gt;

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <ImageView android:id="@+id/maxsapImg" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentTop="true"
        android:scaleType="center" android:src="@drawable/golden_gate">
    </ImageView>

    <RelativeLayout android:id="@+id/InnerRelativeLayout"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <Button android:text="@string/camera" android:id="@+id/camerBtn"
            android:layout_alignParentBottom="true" android:layout_width="wrap_content"
            android:layout_height="wrap_content">
        </Button>

        <Button android:text="@string/local" android:id="@+id/localBtn" android:layout_width="wrap_content"
            android:layout_toLeftOf="@+id/camerBtn" android:layout_height="wrap_content">
        </Button>

    </RelativeLayout>

</RelativeLayout></merge>

but no lick so far any ideas?

regards maxsap.

+1  A: 
<merge xmlns:android="http://schemas.android.com/apk/res/android"&gt;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent" android:layout_height="fill_parent">
    <ImageView android:id="@+id/maxsapImg" android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center" android:src="@drawable/golden_gate"/>
    <RelativeLayout android:id="@+id/InnerRelativeLayout"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" android:layout_centerHorizontal="true">
        <Button android:text="@string/camera" android:id="@+id/camerBtn"
                android:layout_width="wrap_content" android:layout_height="wrap_content"/>
        <Button android:text="@string/local" android:id="@+id/localBtn"  android:layout_width="wrap_content"
                android:layout_toLeftOf="@+id/camerBtn" android:layout_height="wrap_content"/>
    </RelativeLayout>
</RelativeLayout>
</merge>
Konstantin Burov
Thanks for answering but this only lays only on button on the center of the screen, I want to lay them on the bottom and center of the screen, one next to the other. regards maxsap
maxsap
Hmm.. I'm pretty sure that the layout should work as you need. What android version do you run?
Konstantin Burov
I am running android 2.1 using sense ui
maxsap
+1  A: 

I added android:orientation="horizontal" to the RelativeLayout tag and changed toLeftOf to android:layout_toRightOf="@+id/camerBtn" in the second button tag

            <RelativeLayout
                    android:id="@+id/InnerRelativeLayout"
                    android:orientation="horizontal"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true">
                    <Button
                            android:text="@string/camera"
                            android:id="@+id/camerBtn"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                    <Button
                            android:text="@string/local"
                            android:id="@+id/localBtn"
                            android:layout_width="wrap_content"
                            android:layout_toRightOf="@+id/camerBtn"
                            android:layout_height="wrap_content" />
            </RelativeLayout>

This works for me

NickT
Ok that worked just fine thanks a lot for the help both of you.
maxsap