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 método dentro do onCreate(). e coloque no manifest na declaração da activity android:windowSoftInputMode="adjustResize"
Vocês sabem identificar oque estou fazendo de errado??
final View activityRootView = findViewById(R.id.activityRootView);
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 segunda-feira, 4 de maio de 2015 02:23:16 UTC-3, Everton Machado escreveu:
OlaGostaria 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-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário