main_activity.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="iterator.ir.a003.MainActivity"> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="" android:hint="@string/firstNameHint" android:ems="10" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:id="@+id/editTextFirstName" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="" android:hint="@string/lastNameHint" android:ems="10" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:id="@+id/editTextLastName" android:layout_toRightOf="@+id/editTextFirstName" android:gravity="center" android:layout_toEndOf="@+id/editTextFirstName" /> <Button android:text="@string/buttonSave_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editTextLastName" android:id="@+id/buttonSave" android:layout_toRightOf="@+id/editTextFirstName" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> </RelativeLayout>
References
https://www.youtube.com/watch?v=QfF_oFPeh7c&list=PLshdtb5UWjSp0879mLeCsDQN6L73XBZTk&index=8
https://github.com/mhdr/AndroidSamples/tree/master/003