autojs修改toast气泡位置

//本脚本由autojs交流群553908361收集整理
function toastAt0(msg, x, y) {
  importClass(android.widget.Toast);
  importClass(android.view.Gravity);
  var toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
  toast.setGravity(Gravity.TOP | Gravity.LEFT, x, y);
  toast.show();
}

function toastAt(msg, x, y) {
  ui.run(() => toastAt0(msg, x, y));
}

toastAt('测试语句',device.width/2,device.height/2)
//toastAt('测试语句',300,300)
sleep(2000)

你可能感兴趣的:(autojs)