简体   繁体   中英

Codename One TextField on Android, no Enter Key

I have created a simple form with a TextField.

The TextField has a

textField.addActionListener((ActionListener) (ActionEvent evt) -> {
        System.out.println(textField.getText());
    });

When I use the simulator I can press enter. However, when I load this on to a Samsung Galaxy Tab the enter button is replaced by :-) and using a USB keyboard doesn't allow my to pressing enter either.

Thanks

Stuart

TextField defaults to single line whereas TextArea defaults to multi-line hence no enter key as a newline isn't supported.

To enable multi-line entry in a TextField use setSingleLineTextArea(false); .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM