androidconstruct-2

Virtual keyboard (Android) overlaps my Construct 2 game


I'm currently working on a game with Construct 2, but I'm having some problems running it on Android. I posted this topic in the scirra forums, but nobody answered me : https://www.scirra.com/forum/viewtopic.php?f=147&t=188289&p=1104363#p1104363

These are three problems that I think could be easily solved with some code input, but I don't know what I have to code and which programming language I should use (in Construct 2 I only know how to execute HTML, Javascript and XML).

Could anyone please tell me what I have to look for or what to code?

Thank you for your help.


Solution

  • Firstly, you can't stretch canvas to perfectly fit your screen. But, you can try to centre a canvas and set the canvas size to 100%. Next, you should try to resize layout with scale ratio parameter and fill the background in e.g. solid colour.

    You can hide the notification bar (if you use cordova/phonegap) First, install required plugin.

    cordova plugin add cordova-plugin-statusbar
    

    next, go to config.xml in your cordova/phonegap project directory and set StatusBarOverlaysWebView to false. You can also, execute method directly from code when the game is initialised.

    StatusBar.hide();
    

    Thirdly, to adjust virtual keyboard and get a position you should try to detect focused textbox or textarea as normal HTML object. Also, you should change in config.xml

    <preference name="fullscreen" value="false" />
    

    now, when your keyboard was opened, phone reveal the field thay you're editing.