EditText添加android:imeOptions="actionSearch"弹出的键盘中带有搜索按钮
2016-02-23 11:38
721 查看
首先在布局文件中的EditText添加android:imeOptions="actionSearch"
<EditText
android:id="@+id/addmember_phone_ed"
android:gravity="center"
android:layout_margin="15dp"
android:padding="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"/>
然后初始化添加一个事件就行
EditText phoneEd= (EditText) findViewById(R.id.addmember_phone_ed);
<EditText
android:id="@+id/addmember_phone_ed"
android:gravity="center"
android:layout_margin="15dp"
android:padding="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"/>
然后初始化添加一个事件就行
EditText phoneEd= (EditText) findViewById(R.id.addmember_phone_ed);
<pre name="code" class="java"> phoneEd.setOnEditorActionListener(new TextView.OnEditorActionListener(){ @Override public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) { // TODO Auto-generated method stub if(arg1 == EditorInfo.IME_ACTION_SEARCH) { Toast.makeText(AddMemberActivity.this,"呵呵",Toast.LENGTH_SHORT).show(); // search pressed and perform your functionality. } return false; } });
相关文章推荐
- 搜狗百度360市值齐跌:搜索引擎们陷入集体焦虑?
- 本人即将筹备败家日志,敬请期待!
- IE:使用搜索助手
- C++深度优先搜索的实现方法
- 基于文本的搜索
- php实现搜索一维数组元素并删除二维数组对应元素的方法
- 使用Sphinx对索引进行搜索
- asp 多关键词搜索的简单实现方法
- C#使用foreach语句搜索数组元素的方法
- WordPress中用于获取搜索表单的PHP函数使用解析
- JavaScript中数组的排序、乱序和搜索实现代码
- C#编程实现Excel文档中搜索文本内容的方法及思路
- sqlserver中在指定数据库的所有表的所有列中搜索给定的值
- 可以用来搜索当前页面内容的js代码
- 全文搜索和替换
- javascript搜索自动提示功能的实现第1/3页
- iOS应用中UISearchDisplayController搜索效果的用法
- mysql 模糊搜索的方法介绍
- C#搜索文字在文件及文件夹中出现位置的方法
- 基于ajax的简单搜索实现方法