Screen is resized on EditBox's editing

Screen is resized on EditBox's editing
0
#1

I have a problem with EditBox. The game’s orientation is portrait.

On Android, when editing begins, the whole screen is resized (half-sized) in the upper position, and virtual keyboard appears below it.
Is it possible to keep the screen size same (and same location), and virtual keyboard appears over it?

Thanks in advance.

0 Likes

#2

Which creator version do you use?

0 Likes

#3

I use v1.5.0.

0 Likes

#4

How about call this method cc.view.resizeWithBrowserSize(false); before editing start?

0 Likes

#5

On Android, the problem was solved.
But on iPhone, the screen content is scrolled when focused. Do you have any idea?

0 Likes

#6

Does the scroll affect the visibility of Editbox?

On some iOS version, eg 9.x , the virtual keyboard doesn’t push the game screen up, so we add a hack to scroll the screen.

0 Likes

#7

I would like to prevent the screen from scrolling. In my game, the keyboard should be located over the screen which has enough room for the virtual keyboard.

0 Likes

#8

so you could tweak the engine by yourself.

in CCSGEditBox.js, there is a function like this:

function adjustEditBoxPosition (editBox) {
    var worldPos = editBox.convertToWorldSpace(cc.p(0,0));
    var windowHeight = cc.visibleRect.height;
    var windowWidth = cc.visibleRect.width;
    var factor = 0.5;
    if(windowWidth > windowHeight) {
        factor = 0.7;
    }
    setTimeout(function() {
        if(window.scrollY < SCROLLY && worldPos.y < windowHeight * factor) {
            var scrollOffset = windowHeight * factor - worldPos.y - window.scrollY;
            if (scrollOffset < 35) scrollOffset = 35;
            if (scrollOffset > 320) scrollOffset = 320;
            window.scrollTo(scrollOffset, scrollOffset);
        }
    }, TIMER_NAME);
}

you could add some logic to prevent screen move on iOS:

cc.sys.os === cc.sys.OS_IOS
0 Likes

#9

I got the same problem with the screen size and this didn’t fixed it. What can I do ?

0 Likes

#10

Any one can fix this problem, What can i do?

0 Likes

#11

Still getting this problem on Cocos Creator V 2.1.0 for Android.

When EditBox is in focus, the native keyboard pops out, pushing the entire canvas up instead of coming over it as an overlay.

Any advice?

0 Likes