Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard Showed messed up elements' position

I have game which require the input of touch keyboard of the mobile. Its display has problem, whenever the keyboard shows up at the text input focus, all my element which position: absolute gets all messed up.

Is there a plugin that enables mobile keyboard to always show up so that I re-position all the elements OR I need to alter the css to make the elements so that the do not mess up when the keyboard shows up?

How should I implement this?

This is one of the element css:

#mixer{  
    position: absolute;  
    bottom:29%;
    left:25%;
    width: 234px;  
    height: 210px;  
    background: transparent url(img/mixer.png) 0 50px no-repeat;  
} 

enter image description here

Note: I am using Jquery mobile, phonegap on Android environment.

like image 300
shoujo_sm Avatar asked Nov 05 '12 14:11

shoujo_sm


People also ask

How do you make fixed content go above IOS keyboard?

To force it work the same way as Mobile Chrome, you have to use position: absolute, height: 100% for the whole page or a container for your pseudo-fixed elements, intercept scroll, touchend, focus, and blur events. The trick is to put the tapped input control to the bottom of screen before it activates focus.

What is windowSoftInputMode?

The soft keyboard can be configured for each activity within the AndroidManifest. xml file using the android:windowSoftInputMode attribute to adjust both default visibility and also how the keyboard affects the UI when displayed.


2 Answers

In your AndroidManifest.xml, add the following line under the activity with the keyboard:

android:windowSoftInputMode="adjustNothing"

like image 76
Heigo Avatar answered Oct 11 '22 02:10

Heigo


I think that your problem is with your Bottom attribute set to "in this case" 29%. you may want to set it as absolute with TOP instead of bottom.

That way it will be pushing from top instead of looking at the bottom, in this case the keypad.

so you want it at 29% of bottom, 100 - 29 = 71 Remove bottom 29% and change it to top 71%.

like image 21
Manuel Choucino Avatar answered Oct 11 '22 02:10

Manuel Choucino