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 EditText中inputType的属性列表
  2. EditText android:imeOptions与inputType="textMultiLine" 的坑
  3. android inputType属性
  4. android EditText中inputType的属性列表
  5. EditText 报出 “This text field does not specify an inputTyp
  6. Android查询:模拟键盘鼠标事件(adb shell 实现)
  7. 记录EditText的输入属性InputType以及imeOptions
  8. android:imeOptions
  9. android editText 软键盘enter键图标的设置

随机推荐

  1. Android中LocationManager的简单使用01
  2. 学习Android中Application、静态变量和Sh
  3. Android/Java面试题收集
  4. android中部分Intent用法实例
  5. Android SDK Manager无法获取其他版本的
  6. qt部署到android设备,很久没响应解决办法
  7. Android正在启动的提示框
  8. android入门级小软件身高体重计算器源代
  9. Android简单视频播放器之VideoView(一)
  10. Android SDK 在线更新镜像服务器资源