【问题标题】:How to remove EditText material design bottom line in android?如何在 android 中删除 EditText 材料设计底线?
【发布时间】:2021-08-08 04:52:17
【问题描述】:

我在我的 Android 应用程序中使用材料设计“com.google.android.material:material:1.3.0”(只是为密码字段添加密码切换)。我不希望在我的 EditText 中包含其他材料功能。正如您在屏幕截图中看到的那样,触摸 PasswordEditText 时会出现绿线。我怎样才能摆脱它并在材料设计功能之间只留下密码切换? 我试着用 app:boxBackgroundMode="none" app:boxStrokeWidth="0dp" app:boxStrokeWidthFocused="0dp" app:boxStrokeColor="@android:color/transparent" 删除该行,但没有帮助。

这里是 Material design EditText 的 XML:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/editTextTextPersonName2"
    android:layout_width="match_parent"
    android:layout_marginTop="36dp"
    android:layout_marginRight="46dp"
    android:layout_marginLeft="46dp"
    android:paddingLeft="5dp"
    android:layout_height="wrap_content"
    app:hintEnabled="false"
    app:boxBackgroundMode="none"
    app:boxStrokeWidth="0dp"
    app:boxStrokeWidthFocused="0dp"
    app:boxStrokeColor="@android:color/transparent"
    android:ems="10"
    android:background="@drawable/edit_text_background"
    app:passwordToggleEnabled="true"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.503"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName">
    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:textInputLayoutFocusedRectEnabled="false"
        android:hint="Parol"
        android:textSize="20sp"
        android:drawableStart="@drawable/ic_baseline_security_24"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:inputType="textPassword"
        android:drawablePadding="5dp"/>
</com.google.android.material.textfield.TextInputLayout>

【问题讨论】:

    标签: android xml android-studio android-edittext material-design


    【解决方案1】:

    TextInputEditText中设置android:background="@null

    【讨论】:

      猜你喜欢
      • 2020-01-05
      • 1970-01-01
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      • 1970-01-01
      相关资源
      最近更新 更多