2011-05-11 37 views

Respuesta

5

Tienes que @ OverrideonConfigurationChanged a ser capaz de manejar los cambios de tiempo de ejecución:

@Override 
public void onConfigurationChanged(Configuration newConfig) { 
    super.onConfigurationChanged(newConfig); 

    // Checks whether a hardware or on-screen keyboard is available 
    if (newConfig.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO) { 
     Toast.makeText(this, "Keyboard visible", Toast.LENGTH_SHORT).show(); 
    } else if (newConfig.keyboardHidden == Configuration.KEYBOARDHIDDEN_YES) { 
     Toast.makeText(this, "Keyboard hidden", Toast.LENGTH_SHORT).show(); 
    } 
} 

Ejemplo tomado de here. Eche un vistazo a here para campos relacionados con el teclado (entre otros) que podría querer usar.


Editar (RivieraKid): Se ha modificado para tener en cuenta el teclado duro o en pantalla.

+2

que sólo funciona para el teclado de hardware, aunque - ninguna notificación para el teclado de software se da :( – Torp

+0

Es posible que desee cambiar newConfig.hardKeyboardHidden a newConfig.keyboardHidden que también se encarga de los teclados en pantalla – RivieraKid

+0

No importa -. Lo hizo por usted ;-) – RivieraKid

Cuestiones relacionadas