-----汉字最好----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 |
上16 | 20 | 17 | 24 |
中2 | 6 | 3 | 10 |
下32 | 36 | 33 | 40 |
下图展示加入三个默认锚点(值为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.右下);
}