专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > BlackBerry

黑莓开发时关于布局的一些有关问题。

发布时间:2010-05-30 19:36:55 文章来源:www.iduyao.cn 采编人员:星星草
黑莓开发时关于布局的一些问题。。。。。
如, HorizontalFieldManager 为横排的 VerticalFieldManager 为竖排的,他们怎么设置宽带和高度呢?
  VerticalFieldManager  怎么让里面的Field为两排呢?
------最佳解决方案--------------------
自己重载sublayout
示例: 下面的是将field横向平均排列
protected void sublayout(int maxwidth, int maxheight) {
  final int count = getFieldCount();
  if (count > 0) {
    int x = 0;
    final int widthPerField = maxwidth / count;
    int w = widthPerField;
    for (int i = 0; i < count; i++) {
      Field f = getField(i);
      if (i == count - 1) {
        w = maxwidth - x;
      }
      setPositionChild(f, x, 0);
      layoutChild(f, w, maxheight);
      x += widthPerField;
    }
  }
  setExtent(maxwidth, maxheight);// 设置宽度和高度
}
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: