'How to remove the underline in a TextField in CODENAME ONE?

I'm trying to remove the underline that shows in a TextField in codenameone.

'''

TextField username = new TextField("", "", 20, TextArea.USERNAME);

'''

image example



Solution 1:[1]

What you're seeing there is the platform look and feel. So on iOS theme this will look different. Technically this is the border so you can just override it e.g. in CSS with:

border: none;

But this is the WRONG SOLUTION!

The right solution would be:

username.setUIID("MyTextField");

Which will let you explicitly specify in the theme how the component will look and give you 100% full control over the look of the component.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shai Almog