gpt4 book ai didi

Codenameone:警报对话框消息

转载 作者:行者123 更新时间:2023-12-04 03:25:55 25 4
gpt4 key购买 nike

我们想要这种格式的对话框消息并查看并填写 enter image description here

能否请您告诉我如何解决它。我的应用程序需要在所有平台(Android、iOS、Windows)上得到支持,我不想为所有平台单独编写 native 代码。

最佳答案

实际上,在代号 One 中自定义外观更容易,因为所有内容都是用 Java 编写的,您可以从字面上自定义有关任何外观的所有内容。

为了简单起见,我使用代码而不是样式会更好,您可以在主题设计器中自定义 Dialog UIID 和其他 UIID,以获得更大的灵 active 并使这更容易。但是,这需要很多截图和解释,所以我在代码中进行了自定义:

Form f = new Form("Test");
Button b = new Button("Show Dialog");
f.add(b);
b.addActionListener(e -> {
Dialog dlg = new Dialog("Authentication");
Style dlgStyle = dlg.getDialogStyle();
dlgStyle.setBorder(Border.createEmpty());
dlgStyle.setBgTransparency(255);
dlgStyle.setBgColor(0xffffff);

Label title = dlg.getTitleComponent();
title.setIcon(finalDuke.scaledHeight(title.getPreferredH()));
title.getUnselectedStyle().setFgColor(0xff);
title.getUnselectedStyle().setAlignment(Component.LEFT);

dlg.setLayout(BoxLayout.y());
Label blueLabel = new Label();
blueLabel.setShowEvenIfBlank(true);
blueLabel.getUnselectedStyle().setBgColor(0xff);
blueLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
blueLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(blueLabel);
TextArea ta = new TextArea("This is the text you want to appear in the dialog, this might line break if the text is too long...");
ta.setEditable(false);
ta.setUIID("DialogBody");
ta.getAllStyles().setFgColor(0);
dlg.add(ta);

Label grayLabel = new Label();
grayLabel.setShowEvenIfBlank(true);
grayLabel.getUnselectedStyle().setBgColor(0xcccccc);
grayLabel.getUnselectedStyle().setPadding(1, 1, 1, 1);
grayLabel.getUnselectedStyle().setPaddingUnit(Style.UNIT_TYPE_PIXELS);
dlg.add(grayLabel);

Button ok = new Button(new Command("OK"));
ok.getAllStyles().setBorder(Border.createEmpty());
ok.getAllStyles().setFgColor(0);
dlg.add(ok);
dlg.showDialog();
});
f.show();

enter image description here

我建议在主题设计器中进行对话框自定义,并使用更好看的 9 片图像边框。

关于Codenameone:警报对话框消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38802224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com