和键盘操作相关的工具类
package com.flyou.utils;
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
/**
* 打开或关闭软键盘
*
* @author flyou
*
*/...
分类:
其他好文 时间:
2015-03-29 16:32:24
阅读次数:
108
在个别时候,需要强制隐藏Android输入法键盘,如当前键盘正在显示,这个时候点击了侧滑面板,就要强制隐藏输入法键盘。网上常见的方法有:
1、InputMethodManager imm = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftI...
分类:
移动开发 时间:
2015-03-21 17:14:01
阅读次数:
172
一个控制键盘显示与隐藏的工具类分享给大家
public class KeyBoardTool {
/**
* 如果输入法在窗口上已经显示,则隐藏,反之则显示
* @param context
*/
public static void showOrhide(Context context){
InputMethodManager imm = (InputMethodManager) ...
分类:
其他好文 时间:
2015-03-20 22:09:29
阅读次数:
156
public static void collapseSoftInputMethod(Context context, View v) { if (v != null) { InputMethodManager imm = (InputMethodManage...
分类:
移动开发 时间:
2015-03-20 12:22:23
阅读次数:
147
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
//打开或关闭软键盘
public class KeyBoardUtils
{
/**
* 打卡软键盘
*
* @param mEditText输入框...
分类:
移动开发 时间:
2015-02-06 18:55:33
阅读次数:
169
// 如果键盘是显示的,那么隐藏,反之亦然 InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, Inpu...
分类:
其他好文 时间:
2015-01-28 19:28:40
阅读次数:
192
在activity2中弹出来软键盘,点击返回后,进入activity1,里面也有edittext,这样的话软键盘还是会显示在那里,有时挺影响体验的。可以在返回事件中添加这样一个方法:private void closeSoftInput() { InputMethodManager imm ...
分类:
移动开发 时间:
2015-01-23 16:07:03
阅读次数:
138
公司的项目中要求在点击搜索的时候弹出一个搜索框,搜索框中有一个EditText,用于数据搜索关键字,要求在弹出PopupWindow的时候自动弹出软键盘,原以为只要写上着两行代码可以搞的问题:1 InputMethodManager inputMethodManager=(InputMethodMa...
分类:
移动开发 时间:
2015-01-08 19:28:18
阅读次数:
699
键盘的展开和收起主要使用到类InputMethodManager:http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html其大致方法如下:1 public void hide_key...
分类:
移动开发 时间:
2015-01-02 19:53:30
阅读次数:
191
现在有一个需求是说希望可以自动的隐藏和打开软键盘,场景是使用在alert dialog中有一个文本框,弹出dialog同时自动弹出键盘,编辑后点击完成直接关闭。使用的方式是:
inputManager.showSoftInput(tvEditor, InputMethodManager.SHOW_FORCED);
如果使用参数InputMethodManager.SHOW_IMPLICI...
分类:
移动开发 时间:
2014-12-23 15:33:16
阅读次数:
260