视图介绍
属性-id
属性-width
属性-height
属性-padding
属性-layoutMargin
属性-backgroundColor
属性-backgroundImage
属性-visibility
click事件
事件-long click
函数-setBackgroundColor
参数:
function main() {
setupUI();
}
function onUIResume() {
ui('demo').setBackgroundColor('#ff0000')
}
函数-setBackgroundImage
参数:
function main() {
setupUI();
}
function onClick(event) {
ui('demo').setBackgroundImage('/sdcard/bg.png')
// ui('demo').setBackgroundImage('asset:logo1.png')
// ui('demo').setBackgroundImage('https://www.baidu.com/img/bd_logo.png')
}
函数-setVisibility
参数:
function main() {
setupUI();
}
function onUIResume() {
ui('demo').setVisible('gone')
}
函数-setPadding
参数:
function main() {
setupUI();
}
function onUIResume() {
ui('demo').setPadding({left: 10})
}
函数-setMargin
参数:
function main() {
setupUI();
}
function onUIResume() {
ui('demo').setMargin({left: 10})
}
函数-on
参数:
function main() {
setupUI();
ui('demo').on('click', onClick)
}
function onClick() {
console.log('click');
}
函数-off
参数:
function main() {
setupUI();
}
function onUIResume() {
ui('demo').on('click', onClick)
}
function onUIPause() {
ui('demo').off('click')
}
function onClick() {
console.log('click');
}