android:imeOptions指定了弹出键盘时右下角的按键的显示文字,未指定时默认为回车图标。
android:imeOptions="flagNoExtractUi" //使软键盘不全屏显示,只占用一部分屏幕 同时,这个属性还能控件软键盘右下角按键的显示内容,默认情况下为回车键 android:imeOptions="actionNone" //输入框右侧不带任何提示 android:imeOptions="actionGo" //右下角按键内容为'开始' android:imeOptions="actionSearch" //右下角按键为放大镜图片,搜索 android:imeOptions="actionSend" //右下角按键内容为'发送' android:imeOptions="actionNext" //右下角按键内容为'下一步' android:imeOptions="actionDone" //右下角按键内容为'完成'
详细使用见 http://blog.csdn.net/caiwenfeng_for_23/article/details/37900503
当然也需要对这个按键进行设置点击事件:

editText.setOnEditorActionListener(new OnEditorActionListener() {    @Override    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {        // do sth when pressed the enter key in the Soft InputMethod    }});

但是在AlertDialog或这PoupWIndow的EditText当调用requestFocus()方法的时候却不会自动弹出键盘,
此时需要直接调用显示键盘命令,当editText获取焦点的时候。

editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {   @Override   public void onFocusChange(View v, boolean hasFocus) {       if (hasFocus) {            dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);        //pop.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);       }   }});

在必要的时候隐藏输入法界面:

//隐藏输入法界面((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(input.getWindowToken(), 0);

更多相关文章

  1. Android查询:模拟键盘鼠标事件(adb shell 实现)
  2. android editText 软键盘enter键图标的设置
  3. 很实用的android按键处理
  4. Android平台开发-Android keypad map-Android按键识别及映射过程
  5. Android模拟、实现、触发系统按键事件的方法
  6. android 日期时间格式转换;软键盘显示消失;获取系统title
  7. Android按键消息传播流程
  8. 【按键】灭屏后瞬间按返回键,可以点亮屏幕
  9. Android软键盘手动显示、隐藏、布局上移和EditText上移

随机推荐

  1. 解决Android library project cannot be
  2. 模仿android谷歌地图功能开发记录
  3. Android利用CountDownTimer类实现倒计时
  4. android各版本的兼容问题
  5. Android按返回键,程序进入后台运行,不关闭
  6. 在线安装eclipse cdt的地址
  7. Android 文件的下载
  8. Android部分控件示例汇总
  9. Android Studio中 Error:Could not find
  10. Android Retrofit W/System.err: java.ne