Skip to content

Instantly share code, notes, and snippets.

@valterh4ck3r
Created November 11, 2017 19:04
Show Gist options
  • Save valterh4ck3r/75209b530433a3da2a04ad025837e248 to your computer and use it in GitHub Desktop.
Save valterh4ck3r/75209b530433a3da2a04ad025837e248 to your computer and use it in GitHub Desktop.
Text Fields Using TextInputLayout and AppCompatEditText.
<?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:orientation="vertical"
tools:context="br.com.androidpro.textfields.MainActivity">
<android.support.design.widget.TextInputLayout
android:id="@+id/txtlayout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginRight="32dp"
android:layout_marginLeft="32dp">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="textWebEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/txtlayout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginRight="32dp"
android:layout_marginLeft="32dp"
app:counterEnabled="true"
app:counterMaxLength="8"
app:passwordToggleEnabled="true">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_password"
android:inputType="textPassword"
android:maxLength="8" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginRight="32dp"
android:layout_marginLeft="32dp"
android:text="@string/btn_login" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment