Android Studio 0.5.4
Hello,
I have a relativeLayout with 2 columns of EditText's.
I want the second row to start from the center of the screen, and the EditText's in the first column to start from the left and stop at the center.
I have been messing around with centerInParent and centerHorizonatal toLeftOf, but can't seen to get it correct. I don't want to use LinearLayout and hoping to do this just using the RelativeLayout if that is possible. So linearLayout is not an option for me.
Many thanks for any suggestions.
Screenshot:
Style I am using:
<resources>
<style name="addressBookLand">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">22sp</item>
<item name="android:layout_marginBottom">4dp</item>
</style>
</resources>
Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fffc">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="22sp"
android:gravity="center"
android:inputType="text"
android:text="Address Book App"
android:textStyle="bold|italic" />
<EditText
android:id="@+id/etFirstName"
style="@style/addressBookLand"
android:hint="Enter your first name"
android:inputType="text"
android:layout_below="@id/tvTitle"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/etLastName"/>
<EditText
android:id="@+id/etLastName"
style="@style/addressBookLand"
android:hint="Enter your last name"
android:inputType="text"
android:layout_below="@id/tvTitle"
android:layout_centerHorizontal="true"/>
<EditText
android:id="@+id/etAddressLine"
style="@style/addressBookLand"
android:hint="Enter your address"
android:inputType="text"
android:layout_below="@id/etFirstName"/>
<EditText
android:id="@+id/etDistrict"
style="@style/addressBookLand"
android:hint="Enter your district"
android:inputType="text"
android:layout_below="@id/etLastName"
android:layout_toRightOf="@id/etAddressLine"/>
<EditText
android:id="@+id/etCity"
style="@style/addressBookLand"
android:hint="Enter your city"
android:inputType="text"
android:layout_below="@id/etAddressLine"/>
<EditText
android:id="@+id/etPostCode"
style="@style/addressBookLand"
android:hint="Enter your postcode"
android:inputType="number"
android:layout_below="@id/etDistrict"
android:layout_toRightOf="@id/etCity"/>
<EditText
android:id="@+id/etPhoneNumber"
style="@style/addressBookLand"
android:hint="Enter your phone number"
android:inputType="phone"
android:layout_below="@id/etCity"/>
<EditText
android:id="@+id/etEmailAddress"
style="@style/addressBookLand"
android:hint="Enter your email Address"
android:inputType="textEmailAddress"
android:layout_below="@id/etPostCode"
android:layout_toRightOf="@id/etPhoneNumber"/>
<Button
android:id="@+id/btnSubmit"
style="@style/addressBookLand"
android:text="Submit"
android:layout_below="@id/etPhoneNumber"
android:layout_toLeftOf="@id/btnCancel"
android:layout_alignParentLeft="true"/>
<Button
android:id="@+id/btnCancel"
style="@style/addressBookLand"
android:onClick="onClickCancel"
android:text="Cancel"
android:layout_below="@id/etEmailAddress"
android:layout_centerHorizontal="true"/>
</RelativeLayout>