window = floaty.rawWindow(
<vertical>
<button id="按钮"text="按钮"/>
</vertical>
)
setInterval(() => {}, 1000);
wx = 0;
wy = 0;
window.setPosition(wx, wy);
window.按钮.setOnTouchListener(function(view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
X = event.getRawX();
Y = event.getRawY();
return true;
case event.ACTION_MOVE:
x = event.getRawX() - X;
y = event.getRawY() - Y;
window.setPosition(wx + x, wy + y);
return true;
case event.ACTION_UP:
wx += x;
wy += y;
return true;
}
return true;
});
分类: 各种demo
0 条评论