自定义键盘 - 机器人 [英] Custom keyboard - Android

查看:205
本文介绍了自定义键盘 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有 inputTypes 任何已知的组合的的inputText ,将给予一个民垫键盘有特殊字符如 $ * &安培; 。我想,以允许用户输入电话号码,并该字段可以采取提到字符为好。我已经尝试了很多,但似乎都不是给所需的输出。

Is there any known combinations of inputTypes on an inputText that would give a Num-pad keyboard with special characters such as $, *, # and &. I am trying to allow the user to input a number and that field could take the mentioned characters as well. I have tried many but none seem to be giving the required output.

我会创建自己的自定义键盘呢?由于我的要求是非常具体的某些特殊字符,请不要标明这是一个重复的问题。先谢谢了。

Would I have to create my own custom keyboard for this? Since my request is very specific to certain special characters please do not mark this as a duplicate question. Thanks in advance.

推荐答案

您可以使用的 KeyboardView 以定制为您的需要。

You can use KeyboardView to for customizing as your need.

KeyboardView customKeyboard = new KeyboardView(context);
customKeyboard.setKeyboard(new Keyboard(this, R.xml.customLayout));

customKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() {
    //do your work here
}

其中 R.xml.customLayout 指的 /res/xml/customLayout.xml 。一个很好的教程定制键盘。

Where R.xml.customLayout refers to /res/xml/customLayout.xml. A very good tutorial for customizing a keyboard is..

这将有助于你更好。

这篇关于自定义键盘 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆