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.
Asked
Active
Viewed 103 times
0
-
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 Answers
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
-
-
Did you also tried with KEYBOARDHIDDEN_YES and KEYBOARDHIDDEN_NO instead of HARDKEYBOARDHIDDEN_YES and HARDKEYBOARDHIDDEN_NO ? – Nov 20 '13 at 21:17
0
This this code bit in your AndroidManifest
android:windowSoftInputMode="adjustPan"
Hope it helps!

ssmrkj
- 38
- 1
- 7