I shifted the whole layout of my page by 250 when user inputs on the two EditText fields, and I need to shit it back when the keyboard is dismissed, I used
public class DoneOnEditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
try{
if (actionId == EditorInfo.IME_ACTION_DONE
|| actionId == EditorInfo.IME_NULL
|| event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
LoginActivity.rootView.setY(0);
return true;
}
}catch (Exception e){
}
return false;
}
} And it works fine, but when I click the back button, the keyboard is also dismissed and the layout is not shifted back. Is there a way to disable the back button only when the soft keyboard is up?