如何禁用TextInputLayout上的填充? [英] How to disable padding on TextInputLayout?

查看:111
本文介绍了如何禁用TextInputLayout上的填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用TextInputLayout包裹EditText时似乎会自动添加左侧填充,如下面的屏幕截图所示.

There appears to be left padding automatically added when using a TextInputLayout to wrap an EditText as you can see in the screenshot below.

在布局XML中的EditText中没有添加任何填充,但是在渲染视图时,在EditText上似乎保留了填充.在比较TextInputLayout下的TextView时,您会看到这一点.

There is no padding added to the EditText in the layout XML, but when the view is rendered there appears to be left padding on the EditText. You can see this when comparing the TextView below the TextInputLayout.

如何禁止添加此左填充?

How do I disable this left padding from being added?

谢谢!

推荐答案

TextInputLayoutLinearLayout,因此您应该能够指定负的边距或填充,例如

TextInputLayout is a LinearLayout, so you should be able to specify a negative margin or padding, e.g.

            android:layout_marginLeft="-2dp"
            android:layout_marginStart="-2dp"

这将抵消您要消除的空间.

that will offset the space you're trying to eliminate.

-2dp值只是一个猜测;调整值,直到它符合您想要的方式.

The -2dp value is just a guess; tune the value until it lines up the way you want.

这篇关于如何禁用TextInputLayout上的填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆