Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

悬浮球如果拖动到顶部状态栏或者底部虚拟导航栏,拖动不出来了 #124

Open
rjy15210176435 opened this issue May 6, 2020 · 5 comments

Comments

@rjy15210176435
Copy link

No description provided.

@maiduoduo
Copy link

对,我也发现了

@chenlizhong12
Copy link

请问如何解决呢?

@WXFY
Copy link

WXFY commented Jul 24, 2020

解决办法:IFloatWindowImpl类245行 startAnimator()方法之后进行上下边界判断 超出范围强制更新位置;代码如下:
if(upY< mB.mView.getHeight()){ //判断手指离开得位置是否小于控件的高度 如果小于高度 证明控件已有部分超出屏幕
updateY(0); //强制更新为0点
}
if(Util.isScreenOriatationPortrait(mB.mApplicationContext)){ //经测试发现横竖计算方式有差异。此方法是横竖屏判断 true是竖屏false是横屏
if(upY>Util.getScreenHeight(mB.mApplicationContext)-mB.mView.getHeight()){ //同理 判断手指离开得位置是否大于屏幕高度减去控件的高度 证明控件已有部分超出屏幕
updateY(Util.getScreenHeight(mB.mApplicationContext)-mB.mView.getHeight());//强制更新为屏幕高度减去控件高度
}
}else { //以下和竖屏一样
if(upY>Util.getScreenWidth(mB.mApplicationContext)- mB.mView.getHeight()){
updateY(Util.getScreenWidth(mB.mApplicationContext)-mB.mView.getHeight());
}
}
底部得位置需要减去状态的高度 否则控件有状态栏高度的部分在屏幕外。(状态栏非透明情况下)

@z2wenfa
Copy link

z2wenfa commented Jun 5, 2021

https://github.com/z2wenfa/FloatWindow 我处理了这个问题,可以看下我的

@MrLeeys
Copy link

MrLeeys commented Jul 3, 2024

提前获取下 窗口的高度
//内容高度 去除状态栏和导航栏高度
mWindowHeight = Util.getScreenHeight(b.mApplicationContext) - Util.getNavigationBarHeight(b.mApplicationContext);

move中判断下上下
if (newY < 0) {
newY = 0;
}
//包含导航栏的边界
if (newY > mWindowHeight) {
newY = mWindowHeight;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants