android hint 自动消失
来源:互联网 发布:数控编程培训教程 编辑:程序博客网 时间:2024/05/22 14:35
android EditText有个hint属性,可以在用户没有选择输入框时给予提示
但是这个提示必须是在用户有输入字符后才会消失,似乎不太符合国人习惯,有时还会误导,所以要让用户点击到输入框时hint文本就自动消失,方法是监听焦点事件:
写一个公用的方法:
public static OnFocusChangeListener onFocusAutoClearHintListener = new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
EditText textView = (EditText) v;
String hint;
if (hasFocus) {
hint = textView.getHint().toString();
textView.setTag(hint);
textView.setHint("");
} else {
hint = textView.getTag().toString();
textView.setHint(hint);
}
}
};
0 0
- android hint 自动消失
- android hint 自动消失
- android hint 自动消失
- android hint 自动消失
- android hint 自动消失 .
- Android EditText聚焦时hint消失的简单代码
- Android EditText聚焦时hint消失的简单代码
- Android EditText聚焦时hint消失的简单代码
- Android EditText聚焦时hint消失的简单代码
- EditText中hint消失
- Android中ProgressDialog自动消失
- Android禁止dialog自动消失
- android 点击Edittext时hint值不自动隐藏问题
- android中的对话框(AlertDialog)自动消失
- Android对话框显示后自动消失
- android memleak hint
- 王立平--android:hint
- android:点击popupwindow以外区域 popupwindow自动消失(转载)
- iOS开发 第二天 了解视图及启动流程
- Cocos Studio及ListView使用简介
- mysql空间查询
- 职责链模式(chain of responsibility)
- 程序员算法冒险之旅(二)---变态跳台阶问题
- android hint 自动消失
- 附录C 准备NCDC气象数据(加解释)
- 电话源码拨号盘控件
- 如何不翻墙下载Android代码
- 实体框架的优化应该考虑的角度--决定技术选型
- cocostduio Text 控件 添加监听无法响应
- Android学习笔记:使用SurfaceView制作简单游戏(1)
- 使用代码刷QQ的跨年红包
- unity4.6_摄像机跟随模式、观察模式融合(平滑)