function onClick()
-- 点击操作
print("您点击了图片按钮")
-- 重设文本框内容
ui.setTextView("tvId1","显示图片路径:")
ui.newRow("layout1","row2")
-- 创建一个输入框显示路径
ui.addEditText("layout1","editId1","/mnt/sdcard/Pictures/1.jpg")
ui.newRow("layout1","row3")
-- 创建一个图片空间显示图片
ui.addImageView("layout1","imgId2","/mnt/sdcard/Pictures/1.jpg")
-- 控件顶部对齐
ui.setGravity("imgId1",48)
ui.setGravity("tvId1",48)
end
-- 创建一个动态UI页面
ui.newLayout("layout1",-1,-1)
ui.show("layout1",false)
-- 设置UI标题
ui.setTitleText("layout1","图片按钮")
ui.newRow("layout1","row1")
-- 创建一个文本框和图片空间
ui.addTextView("layout1","tvId1","这是一个图片按钮:")
ui.addImageView("layout1","imgId1","/mnt/sdcard/Pictures/yunxing.png")
-- 点击操作
ui.setOnClick("imgId1","onClick()")
sleep(1000000) |