I writing app for Xamarin Android.
I try to use TextInputLayout
Here is my axml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bck">
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Username" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/usernameWrapper"
android:layout_marginTop="5dp">
<EditText
android:id="@+id/username"
android:inputType="textPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="password" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
I need to set Edit Text
on center of screen.
How I can do this?
Thanks
Use this in the TextView
android:layout_gravity="center_vertical"
or horizontal
android:layout_gravity="center_horizontal"