Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Ação quando aparecer o teclado

Ola Douglas tudo bem??
tentei fazer dessas duas formas e nada, ele sempre da true, ele retorna true mesmo quando escondo o teclado com o botão voltar, eu coloquei esse metodo dentro do onCreate(). e coloque no manifest na declaração da activity isso android:windowSoftInputMode="adjustResize"
Você sabe identificar oque estou fazendo de errado?? 

final View activityRootView = findViewById(R.id.cliente_fragment);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {

//--->
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > 100) {
Toast.makeText(ClienteExibirActivity.this, "A", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(ClienteExibirActivity.this, "D", Toast.LENGTH_SHORT).show();
}

//--->
boolean isKeyboardActive = ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).isActive();
if (isKeyboardActive == true) {
Toast.makeText(ClienteExibirActivity.this, "A", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(ClienteExibirActivity.this, "D", Toast.LENGTH_SHORT).show();
}
}
});


Em seg, 4 de mai de 2015 às 17:46, Douglas Drumond <douglas@cafelinear.com> escreveu:

Yep. No manifest precisa de adjustResize p funcionar.


On 2015年5月4日(月) 17:41 Everton Machado <evertonrm89@gmail.com> wrote:
Voces implementaram dessa forma Douglas e jade???

final
 View activityRootView = findViewById(R.id.activityRoot);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
    @Override
    public void onGlobalLayout() {
        int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
        if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...
            //... do something here
        }
     }
});

Em segunda-feira, 4 de maio de 2015 07:28:00 UTC-3, Douglas Drumond escreveu:
Não diretamente. Vc pode escutar onGlobalLayoutListener, ver a diferença de altura na variação do layout e "chutar" que foi teclado aparecendo.


2015-05-04 2:23 GMT-03:00 Everton Machado <evert...@gmail.com>:
Ola
Gostaria de saber se tem como pegar o evento de quando aparece o teclado, pois tenho uma tela onde tenho dois fragments, um com os dados e outro com o botão salvar e cancelar, gostaria de esconder o fragment dos botões quando aparecer o teclado!!

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Em segunda-feira, 4 de maio de 2015 07:28:00 UTC-3, Douglas Drumond escreveu:
Não diretamente. Vc pode escutar onGlobalLayoutListener, ver a diferença de altura na variação do layout e "chutar" que foi teclado aparecendo.


2015-05-04 2:23 GMT-03:00 Everton Machado <evert...@gmail.com>:
Ola
Gostaria de saber se tem como pegar o evento de quando aparece o teclado, pois tenho uma tela onde tenho dois fragments, um com os dados e outro com o botão salvar e cancelar, gostaria de esconder o fragment dos botões quando aparecer o teclado!!

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário