Android Keyboard Tutorial [한국어]

[플러그인 제작 목적]

유니티가 제공하는 안드로이드 키보드는 네이티브 코드가 제공하는 그것에 비해 매우 제한적입니다. 조합형 문자의 경우 Input.compositionString이 정상적인 기능을 하지 않고 있으며, hideInput 플래그 또한 정상 작동 하고 있지 않습니다.  이 플러그인은 이런 제약을 벗어 날 수 있게끔 하며, 거기에 더해서 adjustResize  옵션을 활용 할 수 있도록 해줍니다.

  

[요구 사양]

 Unity 4.6.3 이상

NGUI 3.5.0 이상

Android Mininim API Level : 9 (Android 2.3.1 ‘Gingerbread’)

 

 [AndroidMenifest.xml 생성 혹은 수정]

  1. 기존 AndroidMenifest.xml이 있다면 아래 코드를 추가합니다.

<activity

           android:name=com.OhYeahDev.softInput.KeyboardActivity

           android:configChanges=orientation|fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen

           >

</activity>

  1. 기존 Main Activity가 없다면 위 코드에 아래 코드를 삽입합니다.

 <intent-filter>

          <action android:name=android.intent.action.MAIN />

          <category android:name=android.intent.category.LAUNCHER />

        </intent-filter>

      </activity>

 

  1. 기존 AndroidMenifest.xml이 없으면 Sample_AndroidManifest.xml를 Assets/Plugins/Android 폴더에 복사한 후, 이름에 ‘SamePle_’을 삭제하여 주십시오.

 

 

[액티비티 활성화] 

AndroidKeyboardManager.Install() 메서드를 어플리케이션 구동 시 반드시 호출 해주어야 합니다.

 

 

[키보드 띄우기 및 설정법] 

  1. 스크립트에 네임스페이스를 정의합니다.

  1. 유니티가 제공하는 TouchScreenKeyboard 방식으로 사용하면 됩니다.


 

[추가 옵션 설정]

  1. fullScreen
  • Landscape화면에서 유효한 옵션
  • 키보드를 전체 화면 모드로 나오게 합니다.

Non-FullScreen

 

  1. NoSuggestion
  • 키보드 위의 ‘Suggestion Words’ Bar를 제거합니다.
    • 일부 하드웨어 기종에서 해당 옵션이 적용되지 않습니다.
    • Landscape 화면에서만 가능

 


  1. SoftInputMode
  • InputAdjustType. SOFT_INPUT_ADJUST_RESIZE 

 화면을 키보드 위에 위치하도록 올립니다.

  • InputAdjustType.SOFT_INPUT_ADJUST_PAN 

 위와는 반대로 화면이 고정된 상태로 키보드를 띄웁니다.

  4. KeepKeyboardOn

  • AdditionalOptions.keepKeyboardOn = true;
  • ‘완료’ 혹은 ‘확인’ 버튼을 눌러도 키보드를 비활성화 시키지 않습니다.

 

 

[고급 옵션 설정]

  1. 여러가지 Flag와 Mask들을 추가할 수 있습니다. (InputType.cs 참고)

 

 

 

[NGUI와 연동] 

  1. Assets/Plugins/Android/AndroidKeyboard/NGUI/UIInput.zip 파일을 압축을 풀어 기존의 것에 덮어 씌웁니다.
  • 2015년 현재 NGUI 3.8.0, 3.9.0 버전용 파일이 있습니다.
  • 키보드를 띄우기 전에 옵션 설정을 완료해야 합니다. (hideInput, softInputMode, Nosuggestion, fullScreen 등)
  • hideInput의 경우 아래 코드를 유의해 주십시오. 

  1. InputTest_NGUI.apk 를 설치하여 NGUI 연동 테스트를 해 볼 수 있습니다.

 

[Example Scenes]

* Test_Landscape, Test_Portrait 씬은 UnityEngine.UI를 이용하여 키보드 기능을 테스트 해보는 목적으로 만들었습니다.

* 테스트 용도로 제작 하였으므로, hideInput의 경우, 커서와 문자 드래그 선택 기능이 없습니다.

 

 

Posted in Tutorials
2 comments on “Android Keyboard Tutorial [한국어]
  1. hongsung Park says:

    Unity 2018.2
    NGUI 3.11.4

    플러그인을 구매하여 사용중입니다.
    NGUI와 함께 사용하려고 하는데 예제와 다르게 동작합니다.
    튜토리얼 문서를 보았지만 설명이 너무 부족합니다.
    자세한 사용법이나 플러그인에 포함된 NGUI_TEST 애플리케이션의 프로젝트 파일을 보고 싶습니다.
    빠른 답변을 기대하겠습니다.
    즐거운 하루 보내세요.

    —————————————————

    Unity 2018.2
    NGUI 3.11.4

    I have purchased a plugin and it is in use.
    I want to use it with NGUI but it works differently from the example.
    I have seen the tutorial document, but the description is too lacking.
    I would like to see the detailed usage or the project file of the NGUI_TEST application included in the plugin.
    We look forward to your prompt reply.
    Have a nice day.

    • OhYeah OhYeah says:

      NGUI 2018.3e 버전과 호환 가능하도록 업데이트하여 올렸습니다.
      몇일뒤면 다운로드 가능합니다.
      대응이 늦어져서 대단히 송구스럽습니다. 죄송합니다.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>