@@ -160,7 +160,7 @@ protected View onCreateChild(@NonNull LayoutInflater inflater, @NonNull ViewGrou
160
160
return container ;
161
161
}
162
162
163
- @ NonNull
163
+ @ Nullable
164
164
protected View onCreateBackground (@ NonNull LayoutInflater inflater , @ NonNull ViewGroup parent ) {
165
165
if (getConfig ().mBackgroundView != null ) {
166
166
ViewGroup backgroundParent = (ViewGroup ) getConfig ().mBackgroundView .getParent ();
@@ -346,7 +346,9 @@ protected FrameLayout.LayoutParams generateContentDefaultLayoutParams() {
346
346
347
347
@ Override
348
348
protected void fitDecorInsets (@ NonNull Rect insets ) {
349
- Utils .setViewPadding (getViewHolder ().getContentWrapper (), insets );
349
+ if (getConfig ().mFitInsets ) {
350
+ Utils .setViewPadding (getViewHolder ().getContentWrapper (), insets );
351
+ }
350
352
if (getConfig ().mAvoidStatusBar ) {
351
353
int paddingTop = getViewHolder ().getContentWrapper ().getPaddingTop ();
352
354
int statusBarHeight = Utils .getStatusBarHeightIfVisible (getActivity ());
@@ -618,6 +620,17 @@ public DialogLayer setBackgroundColorRes(@ColorRes int colorRes) {
618
620
return this ;
619
621
}
620
622
623
+ /**
624
+ * 设置是否避开页面内边距
625
+ *
626
+ * @param fitInsets 设置是否避开页面内边距
627
+ */
628
+ @ NonNull
629
+ public DialogLayer setFitInsets (boolean fitInsets ) {
630
+ getConfig ().mFitInsets = fitInsets ;
631
+ return this ;
632
+ }
633
+
621
634
/**
622
635
* 设置避开状态栏
623
636
*
@@ -845,6 +858,7 @@ protected static class Config extends DecorLayer.Config {
845
858
846
859
protected boolean mCancelableOnTouchOutside = true ;
847
860
861
+ protected boolean mFitInsets = true ;
848
862
protected boolean mAvoidStatusBar = false ;
849
863
850
864
protected int mGravity = Gravity .NO_GRAVITY ;
0 commit comments