我是Codenameone的新手是否有任何选项来对齐标签取决于另一个标签,如对齐底部,顶部,右侧和左侧选项?
如何在父布局的中心对齐多个标签?
Here I have attached the code I tried for:
Container center = new Container(new BorderLayout());
Label des = new Label((String) data.get("title"));
des.setUIID("MultiLine2");
center.addComponent(BorderLayout.NORTH,des);
Label author = new Label((String) data.get("author"));
author.setUIID("MultiLine2");
center.addComponent(BorderLayout.SOUTH,author);
cnt.addComponent(BorderLayout.CENTER, center);
I am getting outpul like the below image
Here I have attached what I need for my project
Can anyone please help me How should I do to get my requirement?
2 回答
这会将标签放在容器的绝对中心:
要将中心调整为略微向左移动,您可以向中心容器添加右边距:
这两种方法还用于将标签置于CN1容器内:
和
其中GridLayout(2,1)中的数字2表示您对一列的标签数量 .