Browse Source

Fix for WrapContentViewPager should apply max child height to children to correctly support scrolling. Resolves #1692. (#1710)

Dmitriy Krivoruchko 6 years ago
parent
commit
b53e544bfa

+ 3 - 0
color/src/main/java/com/afollestad/materialdialogs/color/view/WrapContentViewPager.kt

@@ -45,6 +45,9 @@ internal class WrapContentViewPager(
       if (h > maxChildHeight) maxChildHeight = h
       if (h > maxChildHeight) maxChildHeight = h
     }
     }
 
 
+    val maxAllowedHeightFromParent = MeasureSpec.getSize(heightMeasureSpec)
+    if (maxChildHeight > maxAllowedHeightFromParent) maxChildHeight = maxAllowedHeightFromParent
+
     if (maxChildHeight != 0) {
     if (maxChildHeight != 0) {
       newHeightSpec = makeMeasureSpec(maxChildHeight, EXACTLY)
       newHeightSpec = makeMeasureSpec(maxChildHeight, EXACTLY)