public class MainActivity extends AppCompatActivity {
private int x;
private int y;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// 获得点击屏幕的坐标
x = (int) event.getX();
y = (int) event.getY();
// 加载PopupWindow 对应的界面
LayoutInflater inflater = getLayoutInflater();
final View popupView = inflater.inflate(R.layout.popup_entry_layout,null);
// 创建PopupWindow 对象
final PopupWindow popupWindow = new PopupWindow(popupView,400,100); // 第二、第三个参数用来设置弹窗的大小,也可以用WRAP_CONTENT
// 设置位置
popupWindow.showAtLocation(popupView, Gravity.NO_GRAVITY,x,y);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// 1秒后关闭该弹窗
popupWindow.dismiss();
}
},1000);
return true;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有