Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created January 29, 2016 20:38
Show Gist options
  • Save codenameone/d0491ce08ce6b889bbd5 to your computer and use it in GitHub Desktop.
Save codenameone/d0491ce08ce6b889bbd5 to your computer and use it in GitHub Desktop.
A rather elaborate sampleto show off the layered layout Codename One API
Form hi = new Form("Layered Layout");
int w = Math.min(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
Button settingsLabel = new Button("");
Style settingsStyle = settingsLabel.getAllStyles();
settingsStyle.setFgColor(0xff);
settingsStyle.setBorder(null);
settingsStyle.setBgColor(0xff00);
settingsStyle.setBgTransparency(255);
settingsStyle.setFont(settingsLabel.getUnselectedStyle().getFont().derive(w / 3, Font.STYLE_PLAIN));
FontImage.setMaterialIcon(settingsLabel, FontImage.MATERIAL_SETTINGS);
Button close = new Button("");
close.setUIID("Container");
close.getAllStyles().setFgColor(0xff0000);
FontImage.setMaterialIcon(close, FontImage.MATERIAL_CLOSE);
hi.add(LayeredLayout.encloseIn(settingsLabel,
FlowLayout.encloseRight(close)));
@codenameone
Copy link
Author

Sample usage code for LayeredLayout

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment