我使用TextInputLayout有对AppCompatEditText自定义XML的基于形状的背景AppCompatEditText。每当我设置一些错误,错误行从布局开始。有没有什么办法给这个错误线填充。TextInputLayout错误文本填充
4
A
回答
0
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/tx_in_username"
android:errorEnabled="true"
android:layout_marginLeft="@dimen/margin_LEFT_RIGHT"
android:layout_marginRight="@dimen/margin_LEFT_RIGHT"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="36sp"
android:hint="Username"
/>
+0
不要使用marginLeft和marginRight – Mallikarjuna
2
您可以通过使用引用错误的TextView:
TextView textView = (TextView) inputLayout.findViewById(android.support.design.R.id
.textinput_error);
然后你就可以得到它的布局PARAMS的工作。
相关问题
- 1. #姓名?错误填充文本控件
- 2. 如何禁用TextInputLayout上的填充?
- 3. 用TextInputLayout填充整个屏幕区域
- 4. Chrome自动填充正在填写错误的文本输入
- 5. TextInputLayout错误对齐
- 6. Rijndael填充错误
- 7. 填充UILabel文本填充其宽度
- 8. TextInputLayout错误消息大小
- 9. 变化TextInputLayout错误字体?
- 10. FF4中的填充错误
- 11. 错误div未被填充
- 12. Laravel5填充选择错误
- 13. 错误填充的ObservableCollection
- 14. 填充错误 - 在C
- 15. HTML DIV填充错误
- 16. 底部填充div错误
- 17. 填充顺序错误
- 18. 的Android CardView填充错误
- 19. 错误填充c#数组
- 20. 阵列填充错误
- 21. 从DropDownList填充文本框选择用CascadingDropDown填充本身
- 22. TextInputLayout文本区域 - 安卓
- 23. 填充ASP文本框
- 24. 用jQuery填充文本框
- 25. TextView.SetMaxLines填充文本n行
- 26. 帆布填充文本
- 27. 与XmlNode.Attributes填充文本框
- 28. 自动填充文本框
- 29. 自动填充文本框
- 30. 填充文本框与
参考http://stackoverflow.com/questions/32609710/textinputlayout-how-to-give-padding-or-margin-to-hint – sasikumar
你能用你试过的代码更新这个问题吗? – Kae10
使用'setError(null)' –