博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
软键盘隐藏显示工具类
阅读量:4136 次
发布时间:2019-05-25

本文共 1049 字,大约阅读时间需要 3 分钟。

软键盘隐藏显示工具类

public class InputMethodUtils {
/** * 判断输入法是否打开 * @param activity 当前Activity * @return true 打开 */ public static boolean isOpenInputMethod(Activity activity){
InputMethodManager imm =(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); return imm.isActive(); } /** * 显示软键盘 * * @param activity 当前Activity */ public static void showInputMethod(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } /** * 隐藏软键盘 * * @param activity 当前Activity */ public static void hideInputMethod(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow( activity.getWindow().getDecorView().getWindowToken(), 0); }}

转载地址:http://mnsvi.baihongyu.com/

你可能感兴趣的文章
Fire Net HDU - 1045(二分图匹配)
查看>>
The Accomodation of Students HDU - 2444(染色法判断是否为二分图&&二分图匹配)
查看>>
树的距离(牛客网树上主席树+dfs序)
查看>>
[CQOI2015]任务查询系统(差分+主席树)
查看>>
A water problem HDU - 5832
查看>>
Lweb and String HDU - 5842(水题)
查看>>
Danganronpa HDU - 5835(贪心)
查看>>
Super-palindrome(思维)
查看>>
Hakase and Nano(博弈)
查看>>
Master of GCD(差分数组||线段树)
查看>>
[SCOI2015]情报传递(主席树+lca)
查看>>
[SDOI2013]森林(树上主席树+启发式合并+lca)
查看>>
George and Job(动态规划)
查看>>
Covered Points Count(离散化+差分)
查看>>
Three displays(贪心)
查看>>
The World is a Theatre(组合数学)
查看>>
Easy Problem(动态规划)
查看>>
Remove Extra One(思维)
查看>>
Statues(三维bfs)
查看>>
Mike and distribution(思维)
查看>>