Search Unity

Hide textbox for TouchScreenKeyboard

Discussion in 'Android' started by OldGamer, Apr 20, 2015.

  1. OldGamer

    OldGamer

    Joined:
    Apr 20, 2015
    Posts:
    7
    When i start typing in one of the textbox. a keyboard appears like the following.


    I am using NGUI for UI. How to hide this textbox for uiinput ?
    P/S : i am using Unity 5.0p3 and NGUI 3.8.2 release for Sam Sung Galaxy Trend Plus with Android 4.3
     
    Last edited: May 2, 2015
  2. carmodev

    carmodev

    Joined:
    Apr 15, 2015
    Posts:
    6
    Same problem here and no hint all over the internet.
    Have you found a workaround? Very annoying issue =/
     
  3. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    This works cross-platform for all mobile keyboard inputs. According to the mobile keyboard reference, you can use
    Code (CSharp):
    1. TouchScreenKeyboard.hideInput = true;
    You can also check the highlighted box below:
    HideInput.png
     
  4. carmodev

    carmodev

    Joined:
    Apr 15, 2015
    Posts:
    6
    Hi, Scarletshark, and thank you for your anwser.
    Here's the thing. I don't want to hide the keyboard itself, just the textfield shown on top of it (orange in the screenshot of the op).
    However, even cheching the "Hide mobile input" nothing changes - nor the keyboard itself nor the orange input field.
    The orange textfield is attached to the keyboard - it was not placed in the app by the op, it just shows whenever the keyboard is invoked. So you get the textfield of the app AND this over the keyboard being filled at the same time, it just seems bizarre.
     
    Mycroft likes this.
  5. carmodev

    carmodev

    Joined:
    Apr 15, 2015
    Posts:
    6
    Here's a screenshot to better illustrate the strange behavior:

    When I touch any textfield (the one bellow "Usuário" in this case) the keyboard is invoked with this orange framed textfield and i really want to get rid of it.
    Any ideas?
    Thanks in advance!
     
  6. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    Did you try the script I posted? The API docs say it should work.
     
  7. carmodev

    carmodev

    Joined:
    Apr 15, 2015
    Posts:
    6
    Yes, did try it but nothing changed at all :(. I'll start a new post describing the problem in details.
    But thanks as always!
     
  8. OldGamer

    OldGamer

    Joined:
    Apr 20, 2015
    Posts:
    7
    I research & use this method but it is only hide text that type by user.
    Textfield is always top mobile key.
     
  9. MarkLiao

    MarkLiao

    Joined:
    Mar 30, 2015
    Posts:
    1
  10. florent-morin

    florent-morin

    Joined:
    Dec 2, 2014
    Posts:
    12
  11. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I bump this thread because I'm experience the same issue on an application. I have an Input field and I have set TouchScreenKeyboard.hideInput = true in my code. But when the Input filed get the focus, the keyboard open-up and the keyboard input field is shown.

    How can I prevent that ?

    Thanks
     
  12. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    As it says in the docs the input area can only be hidden on iOS. ("Note: Android: only TouchScreenKeyboard.visible input field is supported, hence this value is always false." etc.)

    But is there any native plugin option to provide an alternative or a future plan to change this in Unity?
    It's a particular problem in landscape where the keyboard and text-entry area cover the whole phone screen.
     
  13. adrianplapamaru

    adrianplapamaru

    Joined:
    Aug 21, 2017
    Posts:
    2
    On ios this problem persists on Unity 2018.2.6f1.

    On exported project UI/Keyboard.mm class the external function "UnityKeyboard_SetInputHidden" is not executed when TouchScreenKeyboard.hideInput = true; is executed on Unity.

    You can fix that by hardcoding the "updateInputHidden()" function. Just add this at the beginning of the function:
    "
    if (_inputHidden == 0) {
    _shouldHideInputChanged = 1;
    _inputHidden = 1;
    _shouldHideInput = 1;
    }

    "
     
    highpockets likes this.
  14. highpockets

    highpockets

    Joined:
    Jan 17, 2013
    Posts:
    71
    Thanks for that, works like a charm. I can't believe this is still an issue on version 2020.1.9f1