1
2
3
4
5
6
7
8
9
<code>1</code><code>、</code><code>//隐藏軟鍵盤 </code>
<code>((inputmethodmanager)getsystemservice(input_method_service)).hidesoftinputfromwindow(widgetsearchactivity.</code><code>this</code><code>.getcurrentfocus().getwindowtoken(), inputmethodmanager.hide_not_always); </code>
<code> </code>
<code>2</code><code>、</code><code>//顯示軟鍵盤,控件id可以是edittext,textview </code>
<code>((inputmethodmanager)getsystemservice(input_method_service)).showsoftinput(控件id,</code><code>0</code><code>);</code>