您的位置:首页 > Web前端

BufferTextInputLayout的简单用法

2017-03-29 13:44 417 查看
这个库你可以很多情况都能派上用场,例如用户资料页,用来做密码或用户名的输入长度控制再适合不过,只需简单地指定字数和字数显示的增减性。如下图所示:




不会做GIF图片,从别的位置拷贝过来的。首先添加依赖,依赖的下载地址


点击跳转github下载

XML格式如下:


<org.buffer.android.buffertextinputlayout.BufferTextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="10"
app:counterOverflowTextAppearance="@style/counterOverride"
app:counterTextAppearance="@style/counterText"
app:hintEnabled="true"
app:counterMode="ascending">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/text_hint" />

</org.buffer.android.buffertextinputlayout.BufferTextInputLayout>


这个控件有两个额外属性app:counterMode(模式)和app:displayFromCount(最大数)。其他属性跟基本控件是一样的。


项目链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: