From 9c800bbd28642da8e321af5287ef61b592ba331a Mon Sep 17 00:00:00 2001 From: hitomi <1670957065@qq.com> Date: Fri, 11 Nov 2016 16:39:13 +0800 Subject: [PATCH] Fixed wrap --- .../hitomi/cslibrary/wrap/ShadowWrapper.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cslibrary/src/main/java/com/hitomi/cslibrary/wrap/ShadowWrapper.java b/cslibrary/src/main/java/com/hitomi/cslibrary/wrap/ShadowWrapper.java index 555925f..6660b7c 100644 --- a/cslibrary/src/main/java/com/hitomi/cslibrary/wrap/ShadowWrapper.java +++ b/cslibrary/src/main/java/com/hitomi/cslibrary/wrap/ShadowWrapper.java @@ -52,7 +52,10 @@ private void prepareLayout() { parent.removeView(contentView); shadowLayout = new RelativeLayout(context); - shadowLayout.setLayoutParams(contentView.getLayoutParams()); + ViewGroup.LayoutParams contentViewLp = contentView.getLayoutParams(); + contentViewLp.width = contentView.getWidth(); + contentViewLp.height = contentView.getHeight(); + shadowLayout.setLayoutParams(contentViewLp); parent.addView(shadowLayout, orignalIndex); shadowLayout.addView(contentView, getContentViewLayoutParams()); } @@ -155,6 +158,9 @@ private void decorateLeft(EdgeShadowView.Builder edgeShadowBuilder) { leftRlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } } + + if (shadowSize <= 0) return ; + EdgeShadowView leftEdgeShadow = edgeShadowBuilder .setShadowSize(shadowSize) .setDirection(CrazyShadowDirection.LEFT) @@ -178,6 +184,9 @@ private void decorateTop(EdgeShadowView.Builder edgeShadowBuilder) { topRlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } } + + if (shadowSize <= 0) return ; + EdgeShadowView topEdgeShadow = edgeShadowBuilder .setShadowSize(shadowSize) .setDirection(CrazyShadowDirection.TOP) @@ -201,6 +210,9 @@ private void decorateRight(EdgeShadowView.Builder edgeShadowBuilder) { rightRlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } } + + if (shadowSize <= 0) return ; + EdgeShadowView rightEdgeShadow = edgeShadowBuilder .setShadowSize(shadowSize) .setDirection(CrazyShadowDirection.RIGHT) @@ -224,6 +236,9 @@ private void decorateBottom(EdgeShadowView.Builder edgeShadowBuilder) { bottomRlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } } + + if (shadowSize <= 0) return ; + EdgeShadowView bottomEdgeShadow = edgeShadowBuilder .setShadowSize(shadowSize) .setDirection(CrazyShadowDirection.BOTTOM)