我正在使用密码切换来显示和隐藏密码。而且我不想使用自定义 drawable。但是,当此编辑文本生成错误时,它会覆盖切换密码图标,并且无法向该图标添加填充或边距。如果对此有任何解决方案,那将是一种乐趣。这是我正在使用的代码:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColorHint="@color/white"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/white">
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:hint="@string/password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLength="40"
android:maxLines="1"
android:textColor="@color/white"
android:textColorHint="@color/app_green_color" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud) android android-textinputlayout android-textinputedittext material-components material-components-android