Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 6.0 : TextFieldTTF (Text Input) Soft Keyboard in full screen #17096

Open
siarsky opened this issue Jan 2, 2017 · 2 comments
Open

Android 6.0 : TextFieldTTF (Text Input) Soft Keyboard in full screen #17096

siarsky opened this issue Jan 2, 2017 · 2 comments

Comments

@siarsky
Copy link

siarsky commented Jan 2, 2017

  • cocos2d-x version: cocos2d-x-3.13.1
  • devices test on: Phone Wiko3 (Android 6.0) and Tablet Nexus 7 (Android 5.1.1)
  • developing environments
    • NDK version: NDK 4.9, android-19

Steps to Reproduce:

  1. compile cppTests
  2. run them on Android 5.* and 6.* device
  3. run test 51 : Node : Text Input
  4. On Android 5.1.1 the soft keyboard is shown correctly - does not cover the entire screen
  5. On Android 6.0 the soft keyboard appears incorrectly - in a full screen mode and covers entire screen

Could you please look into this and provide a workaround or a solution?

@siarsky
Copy link
Author

siarsky commented May 23, 2017

Dear cocos2dx team,

I found a similar problem in the forum:

http://discuss.cocos2d-x.org/t/feature-request-disable-fullscreen-keyboard-on-android/19497

any news to this issue? Could you reproduce it?

@siarsky
Copy link
Author

siarsky commented Sep 13, 2017

HISTORY:
An immersive mode was introduced in Android 4.4 (Kitkat), version code 19. This mode allows games to run in a full screen mode - which was then integrated into cocos2dx in a commit "hide virtual button by default" 8634773 on Jun 15, 2016 by minggo

This mode has an disadvantage - it changes the way a soft keyboard behaves. In a versions before KitKat the softkeyboard was in a non full screen mode, for a immersive mode, the default behavior is a full screen mode.

SOLUTION:
In Cocos2dxActivity.java two lines (43, 390) need to be added:
43 import android.view.inputmethod.EditorInfo;
...
389 Cocos2dxEditBox edittext = new Cocos2dxEditBox(this);
390 edittext.setImeOptions(edittext.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
391 edittext.setLayoutParams(edittext_layout_params);

The flag IME_FLAG_NO_EXTRACT_UI makes the trick - then the TextFieldTTF works in the same mode as on iPhones - in a normal non-fullscreen mode.

@minggo : According to my analyses EditBox has already a non full screen implementation on Android. Should not TextFieldTTF have the same default behavior as well (which would be in line with iOS way)? If the team agrees - could the solution be integrated into the next version of cocos2dx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants