开发者

getting numeric keyboard default

How can I change android's default keyboard? I want numeric keyboard to be shown first and then on clicking ABC in the numeric keyboard, I want to show alphabets keyboard. Is that possible to implement? Thanks in adv开发者_如何学JAVAance.


Assuming you're using a TextView for your text input, you simply need to set the inputMethod property.

http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputMethod


As I said in this question, I didn't find any answer to that except if you wrote your own keyboard


You can do that with the word "phone" in inputype property of your EDITTEXT


Use InputType="number" in your edittext


Just implement IME option on your numeric keyboard and once clicked change input type programmatically like this:

EditText editText= (EditText) mView.findViewById(R.id.et_awesome);
editText.setOnEditorActionListener(new EditText.OnEditorActionListener() {
@Override
public boolean onEditorAction(EditText v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
   editText.setInputType(InputType.TYPE_CLASS_TEXT);
   return true;
}
return false;
} 

});

EditText on XML:

<EditText
    ...
    android:imeOptions="actionGo"
    android:imeActionLabel="ABC"
    android:imeActionId="666"
    android:inputType="number"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜