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.
Related
Please teach me how to control the background color when right-clicking on TreeView/TreeItem.
Based on https://codesandbox.io/s/jggxz?file=/demo.tsx which is linked from https://material-ui.com/components/tree-view/ ,
in the case of implementing the context menu function, the background color of the right-clicked item is not as expected.
Let me explain how it works by watching the attached video.
Right-click on "Forums" to bring up the context menu.
Then, for a brief moment, "Forums" will get the focus and the background color will change to pink.
After the background color disappears, the context menu will appear.
Also, up to this point, the background color of "Promotions", which was selected from the beginning, is always green.
What I want is the following. What should I do to make it look like the following?
Right-click on "Forums" to bring up the context menu.
Then the background color of the right-clicked item "Forums" will change to green, and
at the same time, the background color of the selected "Promotions" from the beginning will disappear.
Another thing I tried was to use TreeView's "selected" props and useState, but it did not work as expected.
That version is below.
https://codesandbox.io/s/material-demo-forked-h5z8e?file=/demo.tsx
I'm doing sample on Tabs and its working fine but here my question how to show differentiate between selected and non selected Tabs in codenameone. it means after selecting Tab i want to show different background color.
how can i achieve this?
Change the background color of the selected state of Tab Uiid in your Codename One Designer.
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'm using the 'Blue Flat' theme in a cn1 project, and the checkboxes in a MultiButton component (I suppose following the Button text color) are completely white, making them invisible on a white background. I've tried changing their foreground color in the theme (in the GUI Builder theme tab), I tried replacing the theme files with checkboxes of a darker shade, but nothing seems to affect it.
How can I make the MultiButton checkbox a different color?
The blue theme customizes the checkbox image theme constant which you can remove at which case it should derive theme colors:
https://www.codenameone.com/manual/advanced-theming.html#_theme_constants
Just select the constants tab in the theme and remove the ones relevant to the checkbox.
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.