android 中动态监听Edittext控件内容长度 TextWatcher监听事件
来源:互联网 发布:纳粹十字勋章淘宝 编辑:程序博客网 时间:2024/06/08 18:50
有时候在android中会有一些评论之类的功能实现,会有字数的限制,加一个字数动态提示的效果感觉会人性化一点 提示用户还剩多少个字可以输入 使用 TextWatcher接口监听事件
EditText Advice_Content = (EditText) findViewById(R.id.Preson_Advice_Content);
Advice_Content.addTextChangedListener(mEditText);//文本框监听
TextWatcher mEditText = new TextWatcher() {
//在文本内容发生改变时调用的事件
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
int len = 125-s.length();
Advice_remaining.setText("你还可以输入" + len + "个字");
}
//在文本内容发生改变之前调用的事件
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
//在文本内容发生改变之后调用的事件
@Override
public void afterTextChanged(Editable s) {
}
};
0 0
- android 中动态监听Edittext控件内容长度 TextWatcher监听事件
- Android:EditText动态输入监听TextWatcher
- Android中动态监听EditText控件内容变化
- TextWatcher:监听编辑框EditText中内容的改变
- android EditText控件事件监听
- android EditText控件事件监听
- android EditText控件事件监听
- android EditText控件事件监听
- android EditText控件事件监听
- Android开发中给EditText控件添加TextWatcher监听实现对输入字数的限制
- android EditText长度监听
- 使用TextWatcher监听EditText
- TextWatcher EditText 文本监听
- TextWatcher 监听edittext
- EditText 监听-----TextWatcher
- EditText中的TextWatcher监听
- 使用TextWatcher监听EditText的文本变化之后动态改变EditText里面的内容
- 监听EditText的内容长度
- Centos修改网卡配置
- R语言数据结构
- webdriver获取input元素值的几种方法
- 使用 javacomm20-win32.zip串口包eclispe配置注意点
- 将一个链表翻转
- android 中动态监听Edittext控件内容长度 TextWatcher监听事件
- Oracle中dual虚拟表的用途
- Oracle trunc()函数的用法
- plsql客户端连接远程和本地数据库
- em与px的区别
- 在GitHub上创建博客主页
- BZOJ1009 单模板自动机 矩阵快速幂优化DP
- 记录nginx查看启用命令
- jsp向数据库传递中文参数(变量)乱码问题的解决: