[Objectives of Producing the plugin]
TouchScreenKeyboard provided by Unity is more limited than Android Native SoftKeyboard. When composing characters, ‘Input.compositionString’ does not work well, , as does ‘TouchScreenKeyboard.hideInput’.
I have written this plugin so we can be free from those constraints. In addition, option “adjustResize” is included.
[Requirements]
Unity 4.6.3 or higher
NGUI 3.5.0 or higher
Android Minimum API Level: 9 (Android 2.3.1 Gingerbread)
[Create or modify AndroidMenifest.xml ]
- If you have AndroidMenifest.xml, add the code below
<activity
android:name=“com.OhYeahDev.softInput.KeyboardActivity“
android:configChanges=“orientation|fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen“
>
</activity>
- If you don’t have “Main Activity”, insert the code below inside the code upper.
<intent-filter>
<action android:name=“android.intent.action.MAIN“ />
<category android:name=“android.intent.category.LAUNCHER“ />
</intent-filter>
</activity>
- If you don’t have AndroidMenifest.xml, copy Sample_AndroidManifest.xml to “Assets/Plugins/Android” and remove “Sample_” on the file name.
[Activate the activity]
Right after your application has run, you must call
“AndroidKeyboardManager.Install()” method.
[Open the keyboard and setting options]
- Use the namespaces on the script
- Use the way of TouchScreenKeyboard that Unity provides
[Additional options]
- fullScreen
- Only works in landscape mode
- Show keyboard in full-screen mode
half screen
- No Suggestions
- Removes “Suggestion Words” Bar up on the keyboard
* This option doesn’t work on certain hardware.
* Only works in landscape mode
- SoftInputMode
- InputAdjustType.SOFT_INPUT_ADJUST_RESIZE
Raises the screen up on the keyboard
- InputAdjustType.SOFT_INPUT_ADJUST_PAN
Contrary to the above, this raises the keyboard with the screen fixed
4. KeepKeyboardOn
- AdditionalOptions.keepKeyboardOn = true;
- Keyboard is not hidden when the “Done” button is clicked
[Advanced options]
- Add flags and masks (Please refer to InputType.cs)
[Compatibility for NGUI]
- Unzip “Assets/Plugins/Android/AndroidKeyboard/NGUI Ver/UIInput.zip” and overwrite it on the existing one
- We have the files for NGUI 3.8.0, 3.9.0 (now in summer 2015)
- All options must be completed before opening the keyboard (hideInput, softInputMode, Nosuggestion and fullScreen)
- In case of hideInput, please take notice of the code below.
- Try testing compatibility for NGUI by installing InputTest_NGUI.apk
[Example Scenes]
Test_Landscape, Test_Portrait scenes have been created to try testing the functions of the keyboard
- hideInput has no cursor and “Selection” is not possible because we created this for test.
Leave a Reply