0

I need to hide button at bottom of screen when soft keyboard is appear and then show it when keyboard will disappear. Looks like keyboard overflows button.

roovenier
  • 5
  • 1
  • Look at this post, for the keyboard show/hidden events and play with your button visibility http://stackoverflow.com/questions/4312319/howto-capture-the-virtual-keyboard-show-hide-event-in-android – Sid Nov 20 '13 at 20:53
  • @Sid it doesn't work for soft keyboard – roovenier Nov 20 '13 at 20:55

2 Answers2

0

In the declaration of your activity in manifest, you may add :

<activity android:name=".MyActivity"
    android:configChanges="keyboardHidden"
    android:label="@string/app_name">

Then in your activity, add :

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


    // Checks whether a hardware keyboard is available
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
        // Your keyboard is visible
        yourButton.setVisibility(View.GONE);
    } else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
        // Your keyboard is hidden
        yourButton.setVisibility(View.VISIBLE);
    }
}

More informations about Configuration change in Handling the Configuration Change Yourself

More informations about Configuration class : Configuration

0

This this code bit in your AndroidManifest

android:windowSoftInputMode="adjustPan"

Hope it helps!

ssmrkj
  • 38
  • 1
  • 7