7

Is it possible?

I would like to show the keyboard with the bare basic alphabetic and numeric buttons, no settings key or smiley key or anything like that, just the letters, numbers, space, done, and shift etc.

I swear I happened to catch an article about how to set the keyboard in this mode months ago, but I can't find it now!

I looked at the possible values for android:inputType & android:windowSoftInputMode but I can't see anything that would help. What am I missing?

Update

The software is designed to run on a particular tablet, one that the customers purchase with the software and we control what is installed on it. They currently run Cyanogen 4.2.2 with the standard keyboard.

I.G. Pascual
  • 5,818
  • 5
  • 42
  • 58
CurlyPaul
  • 1,138
  • 1
  • 10
  • 29
  • Well even then there is nothing you can do besides writing your own custom keyboard app. – Xaver Kapeller Mar 21 '14 at 15:46
  • Yeah thats what I was thinking I'll have to do, but I was sure that I saw some sort of 'reduced' mode that developers could use when screen space was tight. Maybe I dreamt it – CurlyPaul Mar 21 '14 at 15:49
  • Well maybe one keyboard app supported that feature, if you find that article again you can find this specific app and ship the tablet with that keyboard preinstalled. But aside from that you aren't gonna get around writing your own keyboard app. – Xaver Kapeller Mar 21 '14 at 15:51
  • I edited a link to a tutorial for writing a custom keyboard into my answer. I will summarise it for you if I find the time in the next few hours. – Xaver Kapeller Mar 21 '14 at 15:54
  • Maybe this is a stupid question, but can you use HTML 5? There is a new input type of number, this will prompt mobile devices for the number keypad. you can look into it here [link](http://www.w3schools.com/html/html5_form_input_types.asp) – Stephen Nielsen Mar 21 '14 at 15:55
  • Well it's still gonna bring up the installed keyboard. Probably with inputType set to number. You can test it but I don't think it will work. – Xaver Kapeller Mar 21 '14 at 15:58
  • 1
    If you don't have the time/budget to write a custom keyboard maybe you should consider just emulating it in your app. A Fragment containing the buttons you need which you position at the bottom of the screen with View.GONE as visibility and set to View.VISIBLE when the user needs it. At the same time you can hide the normal keyboard to prevent it from appearing. – Xaver Kapeller Mar 21 '14 at 16:00
  • I edited my answer accordingly. Please don't forget to upvote and accept my answer if I helped you and if you have any further questions please feel free to ask. – Xaver Kapeller Mar 21 '14 at 16:04
  • @XaverKapeller I already upvoted to counter balance all the downs that the answers got her, I'll take a look at the tutorial and the emulated options and accept the answer if it helps. Thanks for your comments – CurlyPaul Mar 21 '14 at 16:17

3 Answers3

17

Did you give a try to android:inputType="textVisiblePassword".

You can also do it programatically, without changing any other aspect of the EditText with:

editText.setRawInputType(InputType.TYPE_CLASS_TEXT | 
        InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD)

It will show something like this:

textVisiblePassword soft input andrdoid

Allan Veloso
  • 5,823
  • 1
  • 38
  • 36
I.G. Pascual
  • 5,818
  • 5
  • 42
  • 58
3

I think, the only way to achieve what you want it's to create a Custom SoftKeyboard with a custom KeyboardView class.
Here is a tutorial: Custom keyboard and see this SO question: Android app specific soft keyboard especially this answer which links to a open source project.

Community
  • 1
  • 1
Blo
  • 11,903
  • 5
  • 45
  • 99
1

Well there is no general solution for that, you have to remember there is no universal keyboard and even if there were people can just download a different keyboard app from the Play Store. Samsung, HTC, Nexus, all have there own keyboard and many oem even have different ones for different phones.

So aside from setting:

android:inputType="number"

on your EditText's there is nothing you can do. Every keyboard handles this in there own way.

EDIT:

If you control which software is installed than you can write a custom keyboard app or search for a keyboard app which supports the feature you need and which you can ship with your tablet. But aside from that there is nothing you can do.

EDIT 2:

Here is a link to a tutorial which explains how to write a custom keyboard: link

EDIT 3:

You always have the option of just emulating the keyboard. Place a fragment containing the buttons you need at the bottom of the screen with visibility View.GONE and set it to View.VISIBLE when the user needs it. You can prevent the normal keyboard from appearing with this code:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);

I actually did something like that for an app I wrote a few months ago. When you apply a fade & translation animation to the fragment as you set it to View.VISIBLE it actually looks pretty good!

Xaver Kapeller
  • 49,491
  • 11
  • 98
  • 86
  • Why am I getting downvoted? I am the only one who read the question correctly so far... – Xaver Kapeller Mar 21 '14 at 15:44
  • @XaverKapeller its not me! but maybe the question wasn't clear enough. I want number, letters but as many of the others removed as possible. Its the settings key that is causing me trouble – CurlyPaul Mar 21 '14 at 15:47