Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing the keyboard without animation

I have a problem with the animation of the soft-keyboard since ICS. I got an activity for data entry using the soft-keyboard. The window is set to "adjustResize" in order to fit all Views into the screen above the soft-keyboard. Since Android 4 the fancy animation of opening the keyboard, let's the views on my screen "bounce".

It seems, as if the view is layouted, then the keyboard opens and after this the screen is relayouted, leading to kind of a jumpy UX.

There was a similar question: ( How to show/hide the soft keyboard without any animation (e.g. fade) in Java? ) However, the solution over there does not work for me. (tested on 4.2.1)

I would be glad, if anyone has some clues on achieving one of the following solutions:

  • Disable the animation of the soft-keyboard for an activity
  • Retrieve the size of the soft-keyboard in order to set the size of the screen manually

Cheers, Florian

like image 735
Florian Barth Avatar asked Dec 14 '12 09:12

Florian Barth


1 Answers

You can't get the height of soft-keyboard. I don't think there is a need to do so, you can achieve the same use-case by trying different approach.

If you don't want to re-layout screen, you can use android:windowSoftInputMode attribute in-order to have some more control over the screen rendering when soft-keyboard appears.

For Example : If you don't want to resize the view, you can put the following line in manifest file. This will simply display the keyboard on top of the activity.

<activity android:windowSoftInputMode="adjustPan"> 

You can check other options for desired functionality.

For better understanding and more controls, you can refer this tutorial.

Hope, this will give you some hint about implementing your use-case.

like image 84
Moin Ahmed Avatar answered Nov 13 '22 03:11

Moin Ahmed