Reputation: 4417
I have input on a PhoneGap
app for Android
.
when the keyboard is opened it must raise the screen up to see the Input, then see it just above the keyboard.
Once she makes it, the event I wrote to back button does not work anymore! And when I press a different input and the screen becomes normal, the event works ..
Maybe someone has an idea why this happens?
I use PhoneGap 2.2.0 version - Android device 2.2 version
Here my event:
document.addEventListener("backbutton", function (e) {
alert('U press back');
}, false);
Here my input:
<input type="text" id="MyInp"/>
Upvotes: 1
Views: 1515
Reputation: 4417
The problem was solved when I added :
android: windowSoftInputMode = "adjustPan"
in the Manifest.xml file,
I have no idea why .. But it is solved!
Upvotes: 0
Reputation: 2958
Consider this, when you tap on the input box, Android performs an action of bringing in the keyboard on its own, because its the property of an input box.
The natural back button action is to undo the last action or to move to the previous page, etc. Hence, the default back button behaviour is to hide the keyboard.
Android doesn't provide a provision to override that action, it will always hide the keyboard if the focus lies within the input box.
Hope that helps.
@Sahil Mahajan Mj: the questions are highlighted because of the 100% accept rate. Hope mine gets accepted as well.
Upvotes: 3