008 锚点的设计

-----汉字最好----http://blog.csdn.net/stgsd---

锚点表示子对象在父对象内的位置.锚点定义在Const类中;

public  static int 默认;
 public  static int 浮动=64;//自己决定位置
 public  static int 靠上=16;
 public  static int 靠下=32;
 public  static int 靠左=4;
 public  static int 靠右=8;
 public  static int 左上=20;
 public  static int 左中=6;
 public  static int 左下=36;
 public  static int 中上=17;
 public  static int 居中=3;
 public  static int 中下=33;
 public  static int 右上=24;
 public  static int 右中=10;
 public  static int 右下=40;

 

 

锚点左4中2右8
上16201724
中26310
下32363340

 

下图展示加入三个默认锚点(值为0)的色块如何排列

protected void startApp(){
 LZform u=new LZform();
 Display.getDisplay(this).setCurrent(u);
    u.任务栏.风格=2;
    u.标题栏.风格=2;
    u.setTitle("测试默认锚点");
    LZobj t1=new LZobj();
    LZobj t2=new LZobj();
    LZobj t3=new LZobj();
    u.里层.添加元素(t2, 0);
    u.里层.添加元素(t3, 0);
    u.里层.添加元素(t1,0);
    t1.w=200;t1.h=30;t1.背景色=0xffffff;
    t2.w=100;t2.h=50;t2.背景色=0xbb9955;
    t3.w=80;t3.h=80;t3.背景色=0x1199aa;

}

下图展示了常用锚点的位置和值(与Graphics接轨)

protected void startApp(){
 LZform u=new LZform();
 Display.getDisplay(this).setCurrent(u);
    u.任务栏.风格=2;
    u.标题栏.风格=2;
    u.setTitle("测试9大锚点");
   // u.设定样式(2);
    u.里层.添加元素(new LZstr("左上20"),Const.左上);
    u.里层.添加元素(new LZstr("左中6"), Const.左中);
    u.里层.添加元素(new LZstr("左下36"),Const.左下);
    u.里层.添加元素(new LZstr("中上17"),Const.中上);
    u.里层.添加元素(new LZstr("居中3"), Const.居中);
    u.里层.添加元素(new LZstr("中下33"),Const.中下);
    u.里层.添加元素(new LZstr("右上24"),Const.右上);
    u.里层.添加元素(new LZstr("右中10"),Const.右中);
    u.里层.添加元素(new LZstr("右下40"),Const.右下);

 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值