OSDN Git Service

Make Toolbar ignore its minHeight if larger than height
authorChris Banes <chrisbanes@google.com>
Tue, 28 Jun 2016 08:38:29 +0000 (09:38 +0100)
committerChris Banes <chrisbanes@google.com>
Tue, 28 Jun 2016 08:38:29 +0000 (09:38 +0100)
Currently Toolbar lays out all children based on its
minHeight (if set). If that minHeight is larger than
the Toolbar height, then the children are laid out larger
than the Toolbar and clipped.

This CL fixes it back by capping the alignment height.

BUG: 29049143

Change-Id: Ia3389a906b132bb0a2ae41b27116c00744d0ddf4

core/java/android/widget/Toolbar.java

index 0988c92..44b2b59 100644 (file)
@@ -1689,7 +1689,8 @@ public class Toolbar extends ViewGroup {
         collapsingMargins[0] = collapsingMargins[1] = 0;
 
         // Align views within the minimum toolbar height, if set.
-        final int alignmentHeight = getMinimumHeight();
+        final int minHeight = getMinimumHeight();
+        final int alignmentHeight = minHeight >= 0 ? Math.min(minHeight, b - t) : 0;
 
         if (shouldLayout(mNavButtonView)) {
             if (isRtl) {