Skip to content

Commit

Permalink
Merge pull request princekin-f#217 from developerzjy/develop
Browse files Browse the repository at this point in the history
浮窗父布局ParentFrameLayout与子view的context保持一致
  • Loading branch information
princekin-f authored Jul 21, 2022
2 parents 5e7b1a7 + 8006e9e commit 1a65226
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ internal class FloatingWindowHelper(val context: Context, var config: FloatConfi
* 重写自定义布局的touch事件,实现拖拽效果。
*/
private fun addView() {
//浮窗父布局ParentFrameLayout与子view的context保持一致
val rootViewContext = config.layoutView?.run { context } ?: context
// 创建一个frameLayout作为浮窗布局的父容器
frameLayout = ParentFrameLayout(context, config)
frameLayout = ParentFrameLayout(rootViewContext, config)
frameLayout?.tag = config.floatTag
// 将浮窗布局文件添加到父容器frameLayout中,并返回该浮窗文件
val floatingView = config.layoutView?.also { frameLayout?.addView(it) }
Expand Down

0 comments on commit 1a65226

Please sign in to comment.