TextInputLayout和TextInputEditText之间的区别 [英] Difference between TextInputLayout and TextInputEditText
问题描述
需要了解TextInputEditText和TextInputLayout的实际区别是什么,何时应使用它们之一.
Need to know what actually difference between TextInputEditText and TextInputLayout, When should we use one of them.
推荐答案
它们是相互补充的不同布局.
They are different layouts that complement each other functionalities.
- TextInputLayout扩展了LinearLayout
- TextInputEditText扩展了EditText
它们应按以下方式一起使用:
They were meant to be used together like following:
<TextInputLayout>
<TextInputEditText/>
</TextInputLayout>
所有内容都在官方文档中
It's all there on the official docs:
TextInputLayout:
https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html
当用户由于输入文本而隐藏提示时,包装EditText(或后代)以显示浮动标签的布局
Layout which wraps an EditText (or descendant) to show a floating label when the hint is hidden due to the user inputting text
TextInputEditText:
https://developer.android.com/reference/android/support/design/widget/TextInputEditText.html
EditText的特殊子类,专门用作TextInputLayout的子类.
A special sub-class of EditText designed for use as a child of TextInputLayout.
这篇关于TextInputLayout和TextInputEditText之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!