如何删除错误文本(TextInputLayout)上的填充?

时间:2018-03-22 12:29:27

标签: android xml

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="@dimen/textinput_container_height"
app:errorEnabled="true"
app:errorTextAppearance="@style/TextAppearance.AppCompat.Small.ErrorStyle"
tools:hint="@string/ip_printers">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-5dp"
app:errorTextAppearance="@style/TextAppearance.AppCompat.Small.ErrorStyle"
tools:text="1234567890" />

</android.support.design.widget.TextInputLayout>

这是我的代码。如何删除填充到错误文本? img with error img with error

2 个答案:

答案 0 :(得分:0)

您必须删除此行

android:layout_marginStart="-5dp"

如果您需要该保证金,请在parentView - android.support.design.widget.TextInputLayout

中提供

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="@dimen/textinput_container_height"
app:errorEnabled="true"
app:errorTextAppearance="@style/TextAppearance.AppCompat.Small.ErrorStyle"
tools:hint="@string/ip_printers"
android:layout_marginStart="-5dp">

答案 1 :(得分:0)

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

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