Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to hide Keyboard

Hi, I'm new to Titanium and i'm tryin to create a calculator app for my own use. the problem is, that none of the default apple keyboards have the buttons i need, so i'm trying to make a custom keyboard layout with buttons.
My Question is now, how can i hide the keyboard though i focus a textfield to have this blinking bar which indicates a selected textfield. When i blur instantly the keyboard, i won't see the keyboard by selecting the textfield, but also my blue blinking bar is gone. So how can i actually block or hide the keyboard with an active textfield?

— asked November 23rd 2010 by Linus Lehnert
  • custom
  • hide
  • keyboard
  • layout
  • textfield

3 Answers

  • if you're using android, you can call the function:


    for iphone, you can blur the textfield:

    — answered May 18th 2011 by Zheng Da Clinton Goh
    • If this wont work on iPhone try this trick:

      textField.enable = false;
      textField.enable = true;

      — commented April 4th 2012 by Arn Carver
    • id doesnt work for android.. what can i do for android?

      — commented July 30th 2013 by khadar meeran
    • Ti.UI.Android.hideSoftKeyboard(); works on android

      — commented August 5th 2013 by Mark Beech
    • what if you want to undo that? that hides it, if you wanna show it again?

      — commented August 14th 2013 by Gerardo Camarena Gomez
    • I had two text fields. First I enabled and then disabled and blurred the first one. It worked… unless you were focused on the second text field… I had to enable/disable and blur BOTH. I hate to see what it's like if you have ten+ boxes… Maybe you only need to enable/disable/blur the one you're on…

      — commented November 22nd 2013 by Vince Bullinger
  • ###Note: Alloy is being used to give an example, the same approach with different code can be followed in classic too.
    If your form has around 20 fields then blurring all fields doesn't seems to be a good idea.
    One of the approaches could be to add a hidden textfield to your view. for eg.

        <TextField id="hidekb" visible="false" height="0"></TextField>

    Then use the following code to hide the keyboard:


    Cons: If different textfields are using different kind of keyboards, then it might give an wierd effect of different keyboard being shown before your keyboard is removed.

    — answered February 2nd 2014 by Vishal Kumar Singh
  • Here is the solution

    function amabilidad() {
                    var numero = 0;
                    if(ama1.getBackgroundColor() == '#ff6e00') {numero = 1}
                    else if(ama2.getBackgroundColor() == '#ff6e00') {numero = 2}
                    else if(ama3.getBackgroundColor() == '#ff6e00') {numero = 3}
                    else if(ama4.getBackgroundColor() == '#ff6e00') {numero = 4}
                    else if(ama5.getBackgroundColor() == '#ff6e00') {numero = 5}
                    return numero;


    — answered March 12th 2013 by antonio medel
    1 Comment
    • That code has nothing to do with the question and adds nothing to the discussion.

      — commented May 8th 2013 by Dan Kronholm
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.