@@ -142,6 +142,11 @@ public enum Gravity {
142
142
*/
143
143
private final int [] padding = new int [4 ];
144
144
145
+ /**
146
+ * This margins are used for the outmost view.
147
+ */
148
+ private final int [] outMostMargin = new int [4 ];
149
+
145
150
public enum ScreenType {
146
151
HALF , FULL
147
152
}
@@ -177,6 +182,7 @@ private DialogPlus(Builder builder) {
177
182
}
178
183
179
184
System .arraycopy (builder .padding , 0 , padding , 0 , padding .length );
185
+ System .arraycopy (builder .outMostMargin , 0 , outMostMargin , 0 , outMostMargin .length );
180
186
181
187
/**
182
188
* Avoid getting directly from the decor view because by doing that we are overlapping the black soft key on
@@ -185,6 +191,13 @@ private DialogPlus(Builder builder) {
185
191
*/
186
192
decorView = (ViewGroup ) activity .getWindow ().getDecorView ().findViewById (android .R .id .content );
187
193
rootView = (ViewGroup ) inflater .inflate (R .layout .base_container , null );
194
+
195
+ FrameLayout .LayoutParams params = new FrameLayout .LayoutParams (
196
+ ViewGroup .LayoutParams .MATCH_PARENT , ViewGroup .LayoutParams .MATCH_PARENT
197
+ );
198
+ params .setMargins (outMostMargin [0 ], outMostMargin [1 ], outMostMargin [2 ], outMostMargin [3 ]);
199
+ rootView .setLayoutParams (params );
200
+
188
201
contentContainer = (ViewGroup ) rootView .findViewById (R .id .content_container );
189
202
topView = rootView .findViewById (R .id .top_view );
190
203
bottomView = rootView .findViewById (R .id .bottom_view );
@@ -562,6 +575,7 @@ public boolean onTouch(View v, MotionEvent event) {
562
575
public static class Builder {
563
576
private final int [] margin = new int [4 ];
564
577
private final int [] padding = new int [4 ];
578
+ private final int [] outMostMargin = new int [4 ];
565
579
566
580
private BaseAdapter adapter ;
567
581
private Context context ;
@@ -696,6 +710,18 @@ public Builder setScreenType(ScreenType screenType) {
696
710
return this ;
697
711
}
698
712
713
+ /**
714
+ * Add margins to your outmost view which contains everything. As default they are 0
715
+ * are applied
716
+ */
717
+ public Builder setOutMostMargin (int left , int top , int right , int bottom ) {
718
+ this .outMostMargin [0 ] = left ;
719
+ this .outMostMargin [1 ] = top ;
720
+ this .outMostMargin [2 ] = right ;
721
+ this .outMostMargin [3 ] = bottom ;
722
+ return this ;
723
+ }
724
+
699
725
/**
700
726
* Add margins to your dialog. They are set to 0 except when gravity is center. In that case basic margins
701
727
* are applied
0 commit comments