Reputation: 870
Need a layout like this layout
Upvotes: 2
Views: 2515
Reputation: 3796
Support New Library
implementation 'com.google.android.material:material:1.1.0'
Upvotes: 0
Reputation: 3708
You have to add the style style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
to TextInputLayout
If you have moved away from the android support library and are currently using Material Design Components.
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/emailTextInputLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edit_text_horizontal_margin"
android:layout_marginEnd="@dimen/edit_text_horizontal_margin"
android:layout_marginBottom="@dimen/edit_text_vertical_margin"
android:hint="Username"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/emailTextInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
If not, I suggest you to read the article I have written on how to migrate to Material Design Components.
Old Answer:
Eg:
<android.support.design.widget.TextInputLayout
android:id="@+id/emailTextInputLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edit_text_horizontal_margin"
android:layout_marginEnd="@dimen/edit_text_horizontal_margin"
android:layout_marginBottom="@dimen/edit_text_vertical_margin"
android:hint="Username"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.design.widget.TextInputEditText
android:id="@+id/emailTextInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
Upvotes: 4