我有一个简单的TextInputLayout:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPwd"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Passcode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" >
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
然后我在下面有其他观点。
问题在于当我在TextInputLayout上设置错误时,高度会增加并推动所有下面的视图。 我尝试了一种解决方法,即设置一个空的helperText,但是在talkback模式下,空的helperText将被读取,这不是我想要的。
有没有一种清洁的解决方案,而不是将TextInputLayout包装在某个具有固定高度的ViewGroup中?