Use a <RelativeLayout>
and instead of android:layout_marginTop="205dp"
use the property android:layout_below
so you can specify the Button after who it is!
Example
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/reminder" />
<Spinner
android:id="@+id/dates"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/times" />
<Spinner
android:id="@id/times"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentRight="true" />
<Button
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/times"
android:layout_alignParentRight="true"
android:text="@string/done" />
</RelativeLayout>
The Spinner
is after the EdiText
and the Button
is after the second Spinner
ALWAYS
If you want always your button in the left-center of your screen try with this code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true">
<Button
android:id="@+id/play"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/play"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/times" />
<Button
android:id="@id/times"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/score"
android:layout_alignParentRight="true" />
<Button
android:id="@+id/players"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/times"
android:layout_alignParentRight="true"
android:text="@string/done" />
</LinearLayout>
</RelativeLayout>
Use a LinearLayout
like a container and with the property of the RelativeLayout
put it at the left(or right) and center-vertical so all the Buttons inside the LinearLayout
change position from all screens dimension.
Read the documents that i post and see the RelativeLayout paramenter so you can find the solution that it's better for you.
Italian:
Credo tu sia italiano, se usi la proprietà android:layout_below
dici praticamente che l'elemento con questa proprietà si deve posizionare subito sotto un determinato elemento specificato per ID
Poi se vuoi li spazi l'uno dall'altro con un marginTop
.
Per mantenere il tutto centrato usa un LinearLayout, consideralo un container che ha come proprietà del RelativeLayout
quelle di stare a sinistra e al centro della schermata, così si adatta ad ogni schermo.
Some Relative Layout guide
And parameters