2011-03-31 26 views

Respuesta

14

a modo de prueba ..

 InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE); 

para ocultar teclado

 imm.hideSoftInputFromWindow(ed.getWindowToken(), 0); 

para el teclado espectáculo

 imm.showSoftInput(ed, 0); 

donde Ed es EditarTexto ..

+0

Gracias por su respuesta – user671005

+0

problema está resuelto ..? –

+0

sí hombre se resuelve – user671005

4

he estado usando sho wSoftInput por un tiempo pero también he encontrado esta alternativa que simula clic en el EditarTexto utilizando dispatchTouchEvent:

  ed.requestFocus(); 
      ed.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 0, 0, 0)); 
      ed.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, 0, 0, 0)); 

no vi ninguna diferencia sin embargo ...

+0

Genial, funciona incluso cuando se usa un teclado personalizado. 10x – WindRider

Cuestiones relacionadas