1
我試圖顯示一個虛擬鍵盤,當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();
感謝Shai的回覆。在這種情況下,我想要顯示帶有幾個特殊鍵和不同外觀的數字鍵盤(例如,在一條水平線中顯示所有鍵)。我怎麼做? – Rupali
本機鍵盤不允許該級別的定製,除非您從頭開始實施不可移植的VKB。如果你想完全控制,你可以使用帶按鈕的對話框。 –