codenameone - 如何在 CN1 中创建此用户界面?
解决方案
这对于手机来说是一个糟糕的布局,而且在平板电脑中也会显得局促。话虽如此,表格布局非常简单。您也可以使用 GUI 构建器,但我认为表格布局会更容易,您只需要了解跨越。我为此实施了一种方法,但没有完成整个事情,因为它需要一些工作。您还可以使用其他方法,例如明确给出行/列约束等...
// creates the first row of tables and the second row table
for(int iter = 0 ; iter < 9 ; iter++) {
// this method should create the container with the blue box around it
hi.add(createBox());
}
// I use a blank label as a "filler" and span it over the rest of the row
hi.add(tl.createConstraint().horizontalSpan(7), new Label());
// 3rd row box and spacing
hi.add(createBox());
hi.add(new Label());
// 3rd row boxes and first box of 4th row
for(int iter = 0 ; iter < 7 ; iter++) {
hi.add(createBox());
}
hi.add(new Label());
hi.add(createBox());
// this would place the container with the content in the center
hi.add(tl.createConstraint().
horizontalSpan(4).verticalSpan(6), createContent());
hi.add(createBox());
推荐阅读
- sql - 如何从具有执行类型作为嵌入式查询的 Control-M 数据库作业运行 SQL Developer 中存在的存储过程
- javascript - 'id' 已在上层范围内声明
- time - 内部包含 if 指令的循环算法的时间复杂度是多少,运行 n 次?是n^2吗?
- c# - 如何以编程方式将自定义控件添加到表单并显示它?
- python - Python中的正则表达式 - 为什么需要“\”来查找一个时期
- ios - SwiftUI 激活 ForEach 中的所有可用索引
- python - 如何获得天数。数据类型错误。Python
- javascript - 使用 Javascript 的 Hill Cipher Encryption 错误
- java - Which datastore to use when you have unbounded(dynamic) number of fields/attributes for an entity?
- c++ - 如何在向量字符串中搜索元素?