Android 悬浮窗拖动
作者:
yunhen | 来源:发表于
2020-08-31 14:49 被阅读0次//在onTouch 的 MotionEvent.ACTION_MOVE 下
float moveRawX = event.getRawX();
float moveRawY = event.getRawY();
params.x = (int)(moveRawX - mRootView.getWidth()/2) ;
params.y = (int)(moveRawY - mRootView.getHeight()/2) ;
windowManager.updateViewLayout(mRootView,params);
//在 MotionEvent.ACTION_UP:
int x = (int)(event.getRawX() - event.getX());
int y = (int)(event.getRawY() - event.getY() - statuBar);
SharedPrefeUtil.getInstance(mContext).putBackFloatXY(x,y);
本文标题:Android 悬浮窗拖动
本文链接:https://www.haomeiwen.com/subject/uuiusktx.html
网友评论