如何创建类似edittext布局的Gmail

时间:2019-03-23 14:50:09

标签: android

需要这样的布局 I need layout like this, is there any google api for this layout

2 个答案:

答案 0 :(得分:1)

您必须将样式style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"添加到TextInputLayout

例如:

<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>

答案 1 :(得分:0)

支持新库

implementation 'com.google.android.material:material:1.1.0'