TextInputLayout简单用法:hintText上浮动画以及为EditText设置错误信息

本文介绍了TextInputLayout的使用,包括hintText上浮动画、设置EditText错误提示信息和计数功能。通过xml布局文件配置,即可实现这些特性。
摘要由CSDN通过智能技术生成

前几天在某个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=&#
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值