codenameone - How to add image in west and buttons in east side in container of codenameone
问题描述
I would like to create a screen as shown in image.
I have tried the following code, it works fine in simulator but when on device it dont show images it just shows button.So, May I know whats the reason? or Am I doing anything wrong ?
public class PhotoExample extends com.codename1.ui.Form {
Container commandBar = null;
public PhotoAnnotatorScreen(String title) {
setTitle(title);
// give this form a border layout
setLayout(new BorderLayout());
getTitleArea().setPreferredH(0);
drawableArea = new AnnotatingArea(graffitiModel);
addComponent(BorderLayout.CENTER, drawableArea);
buildCommandBar();
getStyle().setBgColor(0x323232);
}
protected void buildCommandBar() {
Container c = new Container();
c.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
c.getStyle().setPadding(Component.TOP, 40);
Button palletteCommand = new Button();
Image im = Image.createImage("/sun.png");
palletteCommand.setIcon(im);
c.addComponent(palletteCommand);
Button cancelCommand = new Button();
Image im = Image.createImage("/Cancel-64-ltgrey.png");
cancelCommand.setIcon(im);
c.addComponent(cancelCommand);
Button okCommand = new Button();
Image im = Image.createImage("/Checked-64-ltgrey.png");
okCommand.setIcon(im);
c.addComponent(okCommand);
addComponent(BorderLayout.EAST, c);
commandBar = c;
}
}
In this case the drawableArea is nothing but the captured image or any image that need to be placed in container.
Please help me out on this. Thanks.
解决方案
推荐阅读
- python - Qt 设计器 PySide2 项目中的“AttributeError:‘bool’对象没有属性‘shown_password’”
- javascript - 为什么 for...of 等待 Promise 解决而 .forEach() 没有?
- c# - 如何从 C# 中的 DateTimeOffset 获取分钟?
- coldfusion - Cold Fusion - 新服务器 - 客户端任务过多
- reactjs - 无法通过 webpack 模块联合使用 material-ui 导入组件
- python - 如何将重复的日期行分组到新列中
- google-chrome - 从 Chrome 开发工具导出大型 HAR 文件
- javascript - 我可以在 GoDaddy 共享主机上托管 Aurelia 应用程序吗?
- swift - SwiftUI - 使用警报更改视图
- db2 - Db2 不允许更新表,抛出错误说操作不完整