I am trying to set the position of my RelativeLayout in the center of the screen. The RelativeLayout is inside of a ScrollView, with the following code. The catch is that in my emulator (Android 4.2) it works great, but if I execute it on a 2.3 version, the RelativeLayout ppears on the top left corner of the screen. I can´t figure out why this is happening.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="75dp"
android:layout_marginLeft="50dp">
<EditText
android:id="@+id/when"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginBottom="20dip"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:minLines="1"
android:maxLines="3"
android:imeOptions="actionDone|flagNoEnterAction" />
<EditText
android:id="@+id/memory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:layout_marginTop="5dip"
android:layout_below="@id/when"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:minLines="1"
android:imeOptions="actionDone|flagNoEnterAction"
android:hint="@string/add_memory_hint"
android:background="#6656B3D4" />
<Button
android:id="@+id/addMemory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/memory"
android:layout_marginTop="20dp"
android:padding="13dp"/>
<Button
android:id="@+id/neverMind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/addMemory"
android:layout_marginTop="20dp"
android:padding="13dp"/>
</RelativeLayout>
</ScrollView>
I would really appreciate some insight. Thank you.