Sign Up Page
Last updated
Was this helpful?
Last updated
Was this helpful?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_blue"
android:orientation="vertical"
android:padding="16dp"
tools:context=".SignUpActivity">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
app:cardCornerRadius="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="10dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_fullname"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_email"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_password"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_confirm_password"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Re-type Password"
android:inputType="textPassword"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_phone_number"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone Number"
android:inputType="phone|number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/tedt_date"
style="@style/SignUpText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Birthdate"
android:inputType="date"
android:textSize="15sp" />
</android.support.design.widget.TextInputLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="@font/purista_medium"
android:gravity="center_horizontal"
android:text="Gender"
android:textSize="18sp" />
<RadioButton
android:id="@+id/radioButton"
style="@style/SignUpText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:checked="false"
android:text="Male" />
<RadioButton
android:id="@+id/radioButton2"
style="@style/SignUpText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:checked="false"
android:text="Female" />
</RadioGroup>
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/btn_sign_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/button_blue"
android:fontFamily="@font/purista_bold"
android:text="Sign UP"
android:textColor="@android:color/white"
android:textSize="20sp" />
</LinearLayout>
Karena di Sign Up Page ini banyak Edit Text dengan attribute yang sama yaitu text size, font style , alangkah lebih baik dan untuk merapikan code, kita dapat menambahkan style di styles.xml.
<style name="SignUpText" parent="Widget.Design.TextInputLayout">
<item name="android:fontFamily">@font/purista_medium</item>
<item name="android:textSize">15sp</item>
</style>
Setelah kita tambahkan styles khusus untuk edittext, langkah selanjutnya yaitu mengimplementasikan style tersebut ke edittext yang akan kita pakai.
style="@style/SignUpText"