@@ -946,6 +946,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
946946 final ActionBar .LayoutParams ablp = lp instanceof ActionBar .LayoutParams ?
947947 (ActionBar .LayoutParams ) lp : null ;
948948
949+ final int layoutDirection = getLayoutDirection ();
950+ lp .resolveLayoutDirection (layoutDirection );
951+
949952 int horizontalMargin = 0 ;
950953 int verticalMargin = 0 ;
951954 if (ablp != null ) {
@@ -1096,9 +1099,9 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
10961099 customView = mCustomNavView ;
10971100 }
10981101 if (customView != null ) {
1099- final int resolvedLayoutDirection = getLayoutDirection ();
11001102 ViewGroup .LayoutParams lp = customView .getLayoutParams ();
1101- lp .resolveLayoutDirection (resolvedLayoutDirection );
1103+ final int layoutDirection = getLayoutDirection ();
1104+ lp .resolveLayoutDirection (layoutDirection );
11021105 final ActionBar .LayoutParams ablp = lp instanceof ActionBar .LayoutParams ?
11031106 (ActionBar .LayoutParams ) lp : null ;
11041107 final int gravity = ablp != null ? ablp .gravity : DEFAULT_CUSTOM_GRAVITY ;
@@ -1139,7 +1142,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
11391142 }
11401143
11411144 int xpos = 0 ;
1142- switch (Gravity .getAbsoluteGravity (hgravity , resolvedLayoutDirection )) {
1145+ switch (Gravity .getAbsoluteGravity (hgravity , layoutDirection )) {
11431146 case Gravity .CENTER_HORIZONTAL :
11441147 xpos = ((mRight - mLeft ) - navWidth ) / 2 ;
11451148 break ;
@@ -1336,11 +1339,15 @@ public int getStartOffset() {
13361339 @ Override
13371340 protected void onMeasure (int widthMeasureSpec , int heightMeasureSpec ) {
13381341 measureChildWithMargins (mUpView , widthMeasureSpec , 0 , heightMeasureSpec , 0 );
1342+ // measureChildWithMargins() has triggered layout params resolution, so no need
1343+ // to do it now
13391344 final LayoutParams upLp = (LayoutParams ) mUpView .getLayoutParams ();
13401345 mUpWidth = upLp .leftMargin + mUpView .getMeasuredWidth () + upLp .rightMargin ;
13411346 int width = mUpView .getVisibility () == GONE ? 0 : mUpWidth ;
13421347 int height = upLp .topMargin + mUpView .getMeasuredHeight () + upLp .bottomMargin ;
13431348 measureChildWithMargins (mIconView , widthMeasureSpec , width , heightMeasureSpec , 0 );
1349+ // measureChildWithMargins() has triggered layout params resolution, so no need
1350+ // to do it now
13441351 final LayoutParams iconLp = (LayoutParams ) mIconView .getLayoutParams ();
13451352 width += iconLp .leftMargin + mIconView .getMeasuredWidth () + iconLp .rightMargin ;
13461353 height = Math .max (height ,
0 commit comments