Skip to content

Commit 06ee57d

Browse files
fix: resolve margin issue for both contentView and decorView
Closes #39
1 parent eb57cc2 commit 06ee57d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

loadingstateview/src/main/java/com/dylanc/loadingstateview/LoadingStateView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class LoadingStateView @JvmOverloads constructor(
111111
onCreateDecorView(contentView.context, LayoutInflater.from(contentView.context)).also { decorView ->
112112
contentView.layoutParams?.let {
113113
decorView.layoutParams = if (it is ConstraintLayout.LayoutParams) ConstraintLayout.LayoutParams(it) else it
114+
(it as? ViewGroup.MarginLayoutParams)?.setMargins(0, 0, 0, 0)
114115
}
115116
}
116117

@@ -199,7 +200,7 @@ class LoadingStateView @JvmOverloads constructor(
199200
internal set
200201
}
201202

202-
private inner class ContentViewDelegate : LoadingStateView.ViewDelegate(ViewType.CONTENT) {
203+
private inner class ContentViewDelegate : ViewDelegate(ViewType.CONTENT) {
203204
override fun onCreateView(inflater: LayoutInflater, parent: ViewGroup) = contentView
204205
}
205206

0 commit comments

Comments
 (0)