princekin-f / EasyFloat

🔥 EasyFloat:浮窗从未如此简单(Android可拖拽悬浮窗口,支持页面过滤、自定义动画,可设置单页面浮窗、前台浮窗、全局浮窗,浮窗权限按需自动申请...)
Apache License 2.0
3.35k stars 431 forks source link

内存泄露 #231

Open leviluo opened 1 year ago

leviluo commented 1 year ago

EasyFloat.with(this).setTag("chanage").setLayout(R.layout.fuqiu).setShowPattern(ShowPattern.FOREGROUND).setDisplayHeight { context -> DisplayUtils.rejectedNavHeight(context) }.setGravity(Gravity.END or Gravity.BOTTOM, 0, -200).show()

this.finish()

当前activity关闭运行finish之后内存就泄露 WechatIMG722

leviluo commented 1 year ago

嗯嗯,我想到了解决方法如下: var act1 = ActivityUtil.instance.getActivity(MainActivity::class.java) act1?.let { EasyFloat.with(it).setTag("chanage").setLayout(R.layout.fuqiu){

MainActivity是我的底层Activity,传入with方法,永远不会销毁,也就不会内存泄露