1
0
kongzue 4 жил өмнө
parent
commit
9f0c2f3c04

+ 26 - 5
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxRelativeLayout.java

@@ -106,11 +106,23 @@ public class MaxRelativeLayout extends RelativeLayout {
         }
         
         View blurView = findViewWithTag("blurView");
-        if (blurView != null) {
-            LayoutParams lp = (LayoutParams) blurView.getLayoutParams();
-            lp.width = getMeasuredWidth();
-            lp.height = getMeasuredHeight();
-            blurView.setLayoutParams(lp);
+        View contentView = findViewWithoutTag("blurView");
+        if (contentView != null) {
+            int widthTemp = contentView.getMeasuredWidth() == 0 ? getMeasuredWidth() : contentView.getMeasuredWidth();
+            int heightTemp = contentView.getMeasuredHeight() == 0 ? getMeasuredHeight() : contentView.getMeasuredHeight();
+            if (blurView != null) {
+                LayoutParams lp = (LayoutParams) blurView.getLayoutParams();
+                lp.width = widthTemp;
+                lp.height = heightTemp;
+                blurView.setLayoutParams(lp);
+            }
+        } else {
+            if (blurView != null) {
+                LayoutParams lp = (LayoutParams) blurView.getLayoutParams();
+                lp.width = getMeasuredWidth();
+                lp.height = getMeasuredHeight();
+                blurView.setLayoutParams(lp);
+            }
         }
         
         int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
@@ -120,6 +132,15 @@ public class MaxRelativeLayout extends RelativeLayout {
         childScrollView = findViewById(R.id.scrollView);
     }
     
+    private View findViewWithoutTag(String tag) {
+        for (int i = 0; i < getChildCount(); i++) {
+            if (!tag.equals(getChildAt(i).getTag())) {
+                return getChildAt(i);
+            }
+        }
+        return null;
+    }
+    
     public boolean isChildScrollViewCanScroll() {
         if (childScrollView == null) return false;
         if (!childScrollView.isEnabled()) {

+ 1 - 1
gradle.properties

@@ -18,5 +18,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.37.beta8
+BUILD_VERSION=0.0.37.beta9
 BUILD_VERSION_INT=36