Android显示隐藏软键盘

1、显示软键盘

public static void showSoftKeyboard(Activity activity)
{
	InputMethodManager inputmethodmanager = (InputMethodManager)activity.getSystemService("input_method");
	if(activity.getCurrentFocus() != null)
	inputmethodmanager.showSoftInput(activity.getCurrentFocus(), 2);
	inputmethodmanager.toggleSoftInput(0, 2);
}

2、隐藏软键盘

public static void hideSoftkeyboard(Activity activity)
{
	if(activity != null && activity.getCurrentFocus() != null)
	{
		InputMethodManager inputmethodmanager = (InputMethodManager)activity.getSystemService("input_method");
		if(inputmethodmanager != null)
		inputmethodmanager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 2);
	}
}

原创内容转载请保留出处GEEK笔记(http://www.geekapp.cn/)。

原创博客,转载请标明出处:http://www.geekapp.cn/archives/169.html
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇