Android disables soft keyboard popup automatically
Last Update:2015-08-25
Source: Internet
Author: User
<span id="Label3"></p><p><p>Android system to edittext this control has a monitoring function, if an activity contains the control, it will automatically eject the soft keyboard to let you enter, this seemingly human-like scheme is sometimes not liked by users, so in some cases to disable the Feature. These days to do the application also has this problem, so check, most of the online is the following method:</p></p><pre><activity android:name=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">. Mainactivity</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">android:screenorientation</span></span>=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">Landscape</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">color: #ff0000;</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>>android:windowsoftinputmode=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">Adjustpan|statehidden</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span></span> <span style=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">color: #ff0000;</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>>android:configchanges=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">orientation|keyboardhidden</span></span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>> <intent-filter> <action android:name=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">Android.intent.action.MAIN</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>/> <category android:name=<span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">Android.intent.category.LAUNCHER</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>/> </intent-filter> </activity></pre><p><p>This method is really useful, but only in this activity can play around, if the activity in the TAB function of the switch, the soft keyboard will bounce out, so the following workaround:</p></p><p><p>Add a hidden TextView to the XML file:</p></p><pre><pre> <<span style="color: #000000;">textview android:id </span> =<span style="color: #800000;"> "</span> <span style="color: #800000;">@+id/config_hidden </span> <span style="color: #800000;" "< span> <span style=" color: #000000; "> android:layout_ Width </span> =<span style="color: #800000;" "< span> <span style=" color: #800000; ">wrap_content </span> <span style="color: #800000;"> "</span> <span style=" color: #000000; "> android:layout_height </span> =<span style=" color: #800000; ">" </span> Span style= "color: #800000;" >wrap_content </span> <span style="color: #800000;" "< span> <span style=" color: #000000; "> android:focusable </span> =<span style="color: #800000;" "< span> <span style=" color: #800000; ">true </span> <span style=" color: #800000; "> "</span> <span style=" color: #000000; "> android:focusableintouchmode </span> =<span style=" color: #800000; ">" </span> <span style="color: #800000;">true </span> <span style="color: #800000;"> "</span>/> </span></span></span></pre></pre><p><p>Then add in the Activity:</p></p><pre><pre><span style="color: #0000ff;"></span>this. Findviewbyid (r.id.config_hidden);</pre></pre><pre><pre>Config_hidden.requestfocus ();</pre></pre><p><p>This will not eject the soft Keyboard.</p></p><p><p>Android disables soft keyboard popup automatically</p></p></span>