Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android show view and hide keyboard at same time. Weird behaviour

I have a custom view that could show a view in same space that should be soft keyboard native for android.

I need to having the keyboard opened, click in a button, hide the keyboard and shows other view in same place that keyboard be/was.

I have that implemented right now just with a hide keyboard and show custom view but has a weird behavior and min lag and overlapping.

Has someone implemented a similar stuff?

like image 949
colymore Avatar asked May 10 '16 13:05

colymore


1 Answers

So what happens in your code is that: Tell system to close the keyboard -> Show red panel with a small delay -> Red panel is shown before keyboard closing -> Since keyboard mode is in adjustResize the red panel shown above keyboard -> Keyboard get closed -> Everything in place

Try to change windowSoftInputMode in manifest from adjustResize to adjustNothing.

Sadly keyboard in android doesn't work smoothly like in IOS, keyboard is handled by OS means you no control over it size, opening/closing animation and no callback! So the best way is to always show red panel and when needed Open keyboard on top of it.

like image 153
Keivan Esbati Avatar answered Oct 25 '22 13:10

Keivan Esbati