android - 如何删除 TextInputLayout 可绘制填充?

标签 android android-edittext android-textinputlayout

我正在使用 ExitText里面 TextInputLayout并启用``

app:passwordToggleEnabled="true"

并得到 Toggle如下图

enter image description here

我想删除 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>

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

最佳答案

您也可以使用此代码

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

关于android - 如何删除 TextInputLayout 可绘制填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56391991/

相关文章:

android - Android 上 Unity 的 ARToolkit : Camera won't start, 只是黑屏

android - 如何在 EditText 中以不同颜色标记值?

android - 在白色背景上带有 float 标签的 TextInputLayout Android 中的可见性问题

java - 如何修复 TextInputLayout 密码切换?

Android SQLite rawQuery 带来麻烦

java - SharedPreferences 在应用程序操作期间发生冲突,然后在应用程序强制关闭/重新启动设备后完全消失的问题

充当按钮的Android白色背景EditText

android - 如何从编辑文本中获取没有小数格式的值

android - 如何使必填字段的 TextInputLayout 提示星号为红色

android - 在 RecyclerView 中滚动时自动在行之间添加空间