圆形文字居中
view.get("label").set({
width:"80px",
height:"80px",
style:{
background:"red",
borderRadius:"50%",//圆形
lineHeight:"80px",//行高和高度一样,可使得该行文字居中
textAlign:"center",
},
text:"哈哈",
});
环形文字居中
view.get("label").set({
width:"100px",
height:"100px",
style:{
background:"red",
borderRadius:"50%",//圆形
//此时label的可用范围100-20=80直径的圆
lineHeight:"80px",//行高和高度一样,可使得该行文字居中
textAlign:"center",
border:"10px blue solid",//环形
},
text:"哈哈",
});
圆形两行文字居中
self.set({
width:"100px",
height:"100px",
style:{
borderRadius:"50%",
background:"red",
}
});
view.get("#labela").set({
style:{
textAlign:"center",
},
text:"aaa",
});
view.get("#labelb").set({
style:{
textAlign:"center",
},
text:"bbb",
});
环形两行文字居中
Container[hbox].set({
width:"200px",
height:"200px",
}
Container[vbox].set(
{
//pack="center"
style:{
width:"100px",
height:"100px",
},
});
view.get("#labela").set({
style:{
textAlign:"center",
}
});
view.get("#labelb").set({
style:{
textAlign:"center",
}
});
使用布局的align和pack
pack:hbox布局则子元素水平排列方式
align:hbox布局则子元素在垂直方向排列方式
hbox时,子元素须设置height,默认高度为100%
vbox时,子元素须设置width,默认宽度为100%