Reputation: 4417
I have an application in Html5 + PhoneGap ..
I want that when you click on a particular element to put it over the keyboard of Android, it is possible to do it via JS?(possible to do it at all?!)
Upvotes: 1
Views: 1214
Reputation: 836
You can interact with the OS by developping a phonegap plugin, but it requires some JAVA code, but I never saw an app that was displaying someting on top of the keyboard, so I'm not sure if this is possible. Using a plugin, you'll be able to execute native code with javascript events :)
Upvotes: 0
Reputation: 72937
Nope, that's not possible.
The keyboard is implemented by the OS itself, you can't overlay stuff over it with JavaScript.
Now, if you want to position a element above the keyboard, instead of overlaying it, take a look at:
How can I position a layout right above the android on-screen keyboard?
Upvotes: 1
Reputation: 16060
Do you want to overlap the keyboard? Hide parts of the Keyboard? -> impossible
Do you want to scroll to a certain position or add an element directly above the keyboard? -> there is a flag, in the AndroidManifest.xml android:windowSoftInputMode
update 1
If it is set to adjustPan the input element will be directly above the keyboard. Now you can use javascript, to calculate a position above the input element. There you should insert your element with an absolute positioning.
update 2
adjustPan may fail, IF you use css: transform() or transform-3d()
Upvotes: 2