Android teclado en pantalla auto apareciendo


Una de mis aplicaciones tiene una "pantalla de apertura" (básicamente un menú) que tiene un EditText seguido de varios Buttons. El problema es que varios de mis usuarios informan que cuando abren la aplicación aparece automáticamente el teclado en pantalla sin que siquiera toquen el EditText. Por lo que puedo decir, todos estos usuarios están utilizando el HTC Hero.

¿Es esto un error en 1.5? ¿Hay algo que pueda hacer al respecto?

Author: mahe madhi, 2010-03-23

10 answers

Puede usar la siguiente línea de código en el método onCreate de la actividad para asegurarse de que el teclado solo aparezca cuando un usuario haga clic en un EditText

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
 263
Author: Donal Rafferty,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-02-06 02:38:22
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Main"
              android:label="@string/app_name"
              android:windowSoftInputMode="stateHidden"
              >

Esto funciona para Android 3.0, 3.1, 3.2, 4.0 - Editor Utilizado para Compilar (Eclipse 3.7)

Coloque el 'windowSoftInputMode="stateHidden"' en el archivo XML de manifiesto de su aplicación para CADA actividad en la que desee que el teclado del software permanezca oculto. Esto significa que el teclado no aparece automáticamente, y el usuario tendrá que haga 'clic' en un campo de texto para mostrarlo. Busqué durante casi una hora algo que funcionara, así que pensé en compartirlo.

 81
Author: mourngrym1969,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-24 22:14:36

Añade esto en tu AndroidManifest.xml :

android:windowSoftInputMode="stateHidden|adjustResize"

Funciona perfectamente. :)

 5
Author: Arun,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-09 05:38:27

Este código funcionará en todas las versiones de Android:

@Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_login);

 //Automatic popping up keyboard on start Activity

     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

 or

 //avoid automatically appear android keyboard when activity start
     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
 }
 5
Author: Satheeshkumar Somu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-31 13:39:33

Puede usar esto en el método onCreate () de la actividad

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

O pegue este código en las etiquetas de actividad en AndroidManifest.xml

android:windowSoftInputMode="stateVisible"
 3
Author: sommer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-19 21:57:52

En esa versión de Android, cuando se infla una vista, el enfoque se establecerá en el primer control enfocable de forma predeterminada, y si no hay un teclado físico, aparecerá el teclado en pantalla.

Para arreglar esto, establezca explícitamente el foco en otro lugar. Si foco está establecido en cualquier otra cosa que no sea un EditText, el teclado en pantalla no aparecerá.

¿Ha intentado probar esto ejecutando Android 1.5 en el emulador?

 1
Author: dmazzoni,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-03-23 01:22:00

Puedes añadir una sola línea de código en Android Mainfest.xml bajo la etiqueta de actividad

 <activity
        android:name="com.sams.MainActivity"
        android:windowSoftInputMode="stateVisible" >
 </activity>

Esto puede ayudarte.

 1
Author: Mohanraj,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-11 09:59:43

Puedes hacerlo programáticamente como

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editTextField.getWindowToken(), 0);

O establecer android:windowSoftInputMode="stateHidden" en <activity tag dentro de AndroidManifest.xml

 1
Author: Xar-e-ahmer Khan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-19 09:02:19
InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
        imm.ShowSoftInput(_enterPin.FindFocus(), 0);

* Esto es para Android.xamarin y FindFocus () - busca la vista en la jerarquía arraigada en esta vista que actualmente tiene foco,como tengo _enterPin.requestFocus () antes del código anterior, por lo tanto, muestra el teclado para _enterPin EditText *

 0
Author: Ruchira,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-13 10:59:52

Esto funcionó para mí:

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
 0
Author: Ajay Jain,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-20 00:47:25