I've set the uiid of a picker in the theme. The font is set in millimeter (2.5) for all unselected, selected and pressed.It works fine. But when I use setEnabled(false), the font style changes and is bigger. P.S I've set same font and same font size for unselected, selected and pressed in the theme. How can I make it work?
Picker stationPicker = new Picker();
stationPicker.setEnabled(false); //without this line, it works fine
stationPicker.setType(Display.PICKER_TYPE_STRINGS);
stationPicker.setSelectedString("Select the service center");
stationPicker.setUIID("small");
stationPicker.getAllStyles().setMarginLeft(1);
stationPicker.getAllStyles().setBgColor(0xcccccc);
when setEnabled isnot used
Img when setEnabled is used
There is another UIID: Disabled.
When you set enabled to false the disabled UIID takes over.
Related
How can I set gap between icon and text of the button. Here I've set the textPosition as Label.BOTTOM. Setting margin or padding in style of icon doesn't work.
Code:
style.setMarginBottom(100);
style.setPaddingBottom(100);
FontImage bookingIcon = FontImage.createMaterial(FontImage.MATERIAL_FILTER_NONE, style, 4);
Button bookingButton = new Button(bookingIcon);
bookingButton.setUIID("SeparateLine");
bookingButton.setText("Book");
bookingButton.setTextPosition(Label.BOTTOM);
This is a special case called "gap". E.g. bookingButton.setGap(pixels); or Label.setDefaultGap(pixels);.
Alternatively you can use the theme constant labelGap which should map to gap size in millimeters.
I want to show a multiline text so I use a span label. I am trying to set the font size from the gui but it does not change.
I also trying to set the color dynamicaly using the next code:
this.gui_Span_Info.getAllStyles().setFgColor(HTMLElement.COLOR_RED);
but nothing happens.
What should I do?
SpanLabel is a composite component which means it's built from 2 or more separate components one of which is a Container.
You can determine the UIID of the text using setTextUIID it defaults to the Label UIID.
I believe the RadioButton "selected" style is not getting set properly.
I am trying to style the radio button using the standard UIID RadioButton in the theme.
I updated the unselected font style to black.
I updated the selected and pressed font style to teal.
It looks like the pressed style works but the selected style does not work. Such that when the radio button is pressed, the font switches to teal but after it gets selected, the font reverts back to black.
Here is the code I used for testing.
Form hi = new Form("Hi World");
hi.addComponent(new RadioButton("Button 1"));
hi.addComponent(new RadioButton("Button 2"));
hi.addComponent(new RadioButton("Button 3"));
hi.show();
First it seems you didn't add the radio buttons to a ButtonGroup which means the radio button won't be selected properly.
Notice the selected style applies to focus of the component and will only appear on touch. It isn't related to the selected state in the radio button which means checked (sorry about that confusing terminology).
I'm guessing you are trying to customize the check symbol which you can customize via theme constants.
I just started building my first App with Codename One and I'm having quite some trouble. :-)
I cant change the background color of a TextField, I changed everything in the Theme and named it "TextField". At the Color tab I changed the background color and set Transparency to 255. Since the Component is named TextField, shouldnt the style be applied automatically when I make a new TextField?
I also tried to set the UIID manually to "TextField", which didn't help either.
Am I missing something?
Kind regards,
Max
The way backgrounds work in Codename One is this:
Border is applied first
Then image
Then gradient
Then color
TextField and other components such as Button etc. often have a default border derived from the theme.
Switch to the Border tab, click derive then click the ... button and select empty.
I am using the CodenameOne blue theme ('shipped with' CodenameOne). I added checkboxes to a BoxLayout.Y container. When selecting one of the checkboxes, the checkbox is getting smaller and wider. I looked in the theme but I can't find out why.
Tested on Android 4.4
I added two images to show what happens. In the first, METAR was checked (and unchecked I guess), in the second, TAF was checked.
After checking another one, the size of the checkbox selected before is normal again.
There are 4 different state selected,unselected , pressed and disabled . And all styles of checkbox can be viewed in theme and as the screenshot there is blank in pressed and disabled style so generate the styles from theme.