Skip to content

Commit 9c800bb

Browse files
committed
Fixed wrap
1 parent cbf91c6 commit 9c800bb

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

cslibrary/src/main/java/com/hitomi/cslibrary/wrap/ShadowWrapper.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ private void prepareLayout() {
5252
parent.removeView(contentView);
5353

5454
shadowLayout = new RelativeLayout(context);
55-
shadowLayout.setLayoutParams(contentView.getLayoutParams());
55+
ViewGroup.LayoutParams contentViewLp = contentView.getLayoutParams();
56+
contentViewLp.width = contentView.getWidth();
57+
contentViewLp.height = contentView.getHeight();
58+
shadowLayout.setLayoutParams(contentViewLp);
5659
parent.addView(shadowLayout, orignalIndex);
5760
shadowLayout.addView(contentView, getContentViewLayoutParams());
5861
}
@@ -155,6 +158,9 @@ private void decorateLeft(EdgeShadowView.Builder edgeShadowBuilder) {
155158
leftRlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
156159
}
157160
}
161+
162+
if (shadowSize <= 0) return ;
163+
158164
EdgeShadowView leftEdgeShadow = edgeShadowBuilder
159165
.setShadowSize(shadowSize)
160166
.setDirection(CrazyShadowDirection.LEFT)
@@ -178,6 +184,9 @@ private void decorateTop(EdgeShadowView.Builder edgeShadowBuilder) {
178184
topRlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
179185
}
180186
}
187+
188+
if (shadowSize <= 0) return ;
189+
181190
EdgeShadowView topEdgeShadow = edgeShadowBuilder
182191
.setShadowSize(shadowSize)
183192
.setDirection(CrazyShadowDirection.TOP)
@@ -201,6 +210,9 @@ private void decorateRight(EdgeShadowView.Builder edgeShadowBuilder) {
201210
rightRlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
202211
}
203212
}
213+
214+
if (shadowSize <= 0) return ;
215+
204216
EdgeShadowView rightEdgeShadow = edgeShadowBuilder
205217
.setShadowSize(shadowSize)
206218
.setDirection(CrazyShadowDirection.RIGHT)
@@ -224,6 +236,9 @@ private void decorateBottom(EdgeShadowView.Builder edgeShadowBuilder) {
224236
bottomRlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
225237
}
226238
}
239+
240+
if (shadowSize <= 0) return ;
241+
227242
EdgeShadowView bottomEdgeShadow = edgeShadowBuilder
228243
.setShadowSize(shadowSize)
229244
.setDirection(CrazyShadowDirection.BOTTOM)

0 commit comments

Comments
 (0)