如何删除 TextInputLayout 可绘制填充?

mus*_*off 6 android android-edittext android-textinputlayout

ExitText在里面使用TextInputLayout并启用了``

app:passwordToggleEnabled="true"
Run Code Online (Sandbox Code Playgroud)

并得到Toggle如下视图

在此输入图像描述

我想删除右侧的填充toggle,但不知何故无法做到。我已经把一切都设置好了0dp,但没有成功。

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:passwordToggleEnabled="true"
    android:layout_margin="0dp"
    android:padding="0dp">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="0dp"
        android:layout_margin="0dp"
        android:drawablePadding="0dp"/>

</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

有一些幼稚的解决方案,例如设置负边距,但由于我不知道填充的大小,我也无法这样做。有什么建议吗?

小智 0

您也可以使用此代码

<android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:passwordToggleEnabled="true">

    <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" android:inputType="textPassword"/>

</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)