Loading core/java/com/android/internal/view/menu/ActionMenuView.java +40 −14 Original line number Diff line number Diff line Loading @@ -400,6 +400,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo int nonOverflowCount = 0; int widthRemaining = right - left - getPaddingRight() - getPaddingLeft(); boolean hasOverflow = false; final boolean isLayoutRtl = isLayoutRtl(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); if (v.getVisibility() == GONE) { Loading @@ -414,8 +415,15 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo } int height = v.getMeasuredHeight(); int r = getWidth() - getPaddingRight() - p.rightMargin; int l = r - overflowWidth; int r; int l; if (isLayoutRtl) { l = getPaddingLeft() + p.leftMargin; r = l + overflowWidth; } else { r = getWidth() - getPaddingRight() - p.rightMargin; l = r - overflowWidth; } int t = midVertical - (height / 2); int b = t + height; v.layout(l, t, r, b); Loading Loading @@ -448,6 +456,23 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo final int spacerCount = nonOverflowCount - (hasOverflow ? 0 : 1); final int spacerSize = Math.max(0, spacerCount > 0 ? widthRemaining / spacerCount : 0); if (isLayoutRtl) { int startRight = getWidth() - getPaddingRight(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); final LayoutParams lp = (LayoutParams) v.getLayoutParams(); if (v.getVisibility() == GONE || lp.isOverflowButton) { continue; } startRight -= lp.rightMargin; int width = v.getMeasuredWidth(); int height = v.getMeasuredHeight(); int t = midVertical - height / 2; v.layout(startRight - width, t, startRight, t + height); startRight -= width + lp.leftMargin + spacerSize; } } else { int startLeft = getPaddingLeft(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); Loading @@ -464,6 +489,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo startLeft += width + lp.rightMargin + spacerSize; } } } @Override public void onDetachedFromWindow() { Loading Loading
core/java/com/android/internal/view/menu/ActionMenuView.java +40 −14 Original line number Diff line number Diff line Loading @@ -400,6 +400,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo int nonOverflowCount = 0; int widthRemaining = right - left - getPaddingRight() - getPaddingLeft(); boolean hasOverflow = false; final boolean isLayoutRtl = isLayoutRtl(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); if (v.getVisibility() == GONE) { Loading @@ -414,8 +415,15 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo } int height = v.getMeasuredHeight(); int r = getWidth() - getPaddingRight() - p.rightMargin; int l = r - overflowWidth; int r; int l; if (isLayoutRtl) { l = getPaddingLeft() + p.leftMargin; r = l + overflowWidth; } else { r = getWidth() - getPaddingRight() - p.rightMargin; l = r - overflowWidth; } int t = midVertical - (height / 2); int b = t + height; v.layout(l, t, r, b); Loading Loading @@ -448,6 +456,23 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo final int spacerCount = nonOverflowCount - (hasOverflow ? 0 : 1); final int spacerSize = Math.max(0, spacerCount > 0 ? widthRemaining / spacerCount : 0); if (isLayoutRtl) { int startRight = getWidth() - getPaddingRight(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); final LayoutParams lp = (LayoutParams) v.getLayoutParams(); if (v.getVisibility() == GONE || lp.isOverflowButton) { continue; } startRight -= lp.rightMargin; int width = v.getMeasuredWidth(); int height = v.getMeasuredHeight(); int t = midVertical - height / 2; v.layout(startRight - width, t, startRight, t + height); startRight -= width + lp.leftMargin + spacerSize; } } else { int startLeft = getPaddingLeft(); for (int i = 0; i < childCount; i++) { final View v = getChildAt(i); Loading @@ -464,6 +489,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo startLeft += width + lp.rightMargin + spacerSize; } } } @Override public void onDetachedFromWindow() { Loading