codenameone虚拟键盘没有显示在Android设备

我试图显示一个虚拟键盘,当TextField的重点。当我在Android手机上测试它时,它的默认键盘正在显示,而不是自定义键盘。codenameone虚拟键盘没有显示在Android设备

Form testForm = new Form(new BorderLayout()); 

TextField txt = new TextField();

String[][] arrOfNumbers = new String[][]{{"1","2","3",}, {"4","5","6",}, {"7","8","9",}, {"0", "00", "$OK$"}};

VirtualKeyboard virtualKB = new VirtualKeyboard();

virtualKB.addInputMode("NUM_KB", arrOfNumbers);

virtualKB.setInputModeOrder(new String[]{"NUM_KB"});

VirtualKeyboard.bindVirtualKeyboard(txt, virtualKB);

testForm.add(BorderLayout.NORTH, txt);

testForm.show();

回答:

虚拟键盘类是遗留功能的一部分,不应使用。 Codename One使用本地输入,您的代码将使用本地数字输入:

Form testForm = new Form(new BorderLayout()); 

TextField txt = new TextField();

txt.setConstraint(TextField.NUMERIC);

testForm.add(BorderLayout.NORTH, txt);

testForm.show();

以上是 codenameone虚拟键盘没有显示在Android设备 的全部内容, 来源链接: utcz.com/qa/260300.html

回到顶部