前几天在某个app的注册界面发现当编辑框获得焦点的时候,hintText会自动上浮,当时觉得这app做的还挺好的,居然还设置了动画效果。
结果后来百度了一下,发现居然是google提供的support库里自带的。。只能说当时自己没关注google的I/O发布会
于是回家研究了TextInputLayout的用法,来和大家分享。
/**
* Layout which wraps an {@link android.widget.EditText} (or descendant) to show a floating label
* when the hint is hidden due to the user inputting text.
*
* <p>Also supports showing an error via {@link #setErrorEnabled(boolean)} and
* {@link #setError(CharSequence)}, and a character counter via
* {@link #setCounterEnabled(boolean)}.</p>
*
* The {@link TextInputEditText} class is provided to be used as a child of this layout. Using
* TextInputEditText allows TextInputLayout greater control over the visual aspects of any
* text input. An example usage is as so:
*
* <pre>
* <android.support.design.widget.TextInputLayout
* android:layout_width=&#