我的屏幕上有2个textArea,其中包含必要的提示文本。如果最后一个textArea被聚焦,则出现键盘,但是如果另一个textArea被聚焦,而不是在键盘上键入,新文本将与文本提示重叠。我也在textFields中进行了测试,但是这里的提示一集中起来就会消失。但是,在textArea中并非如此。附注:我已经在Android设备上测试了该应用。
看看视频here.
代码:
Label reasonLabel = new Label("Reason* ");
TextArea reasonData = new TextArea();
Container reasonContainer = common.Inputs.inputTextArea(reasonData, "Reason For Ownership Transfer", reasonLabel);
Label remarksLabel = new Label("Remarks ");
TextArea remarksData = new TextArea();
Container remarksContainer = common.Inputs.inputTextArea(remarksData, "Additional Info If Any", remarksLabel);
Container mainContainer = BoxLayout.encloseY(phnNoContainer, emailContainer, BoxLayout.encloseY(reasonContainer), BoxLayout.encloseY(remarksContainer));
add(BorderLayout.CENTER, BoxLayout.encloseY(mainContainer, submitButton));
common.Inputs.inputTextArea方法:
public static Container inputTextArea(TextArea textArea, String hint, Label textAreaLabel) {
textArea.setHint(hint);
textArea.setRows(2);
textArea.setGrowByContent(false);
textArea.getHintLabel().setUIID("TextField");
Container remarksContainer = BoxLayout.encloseY(textAreaLabel, textArea);
return remarksContainer;
}