diff options
| -rw-r--r-- | core/java/android/widget/RelativeLayout.java | 21 | ||||
| -rw-r--r-- | core/res/res/layout-land/time_picker_material.xml | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 181ad31deddc..33e65214996b 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -833,25 +833,28 @@ public class RelativeLayout extends ViewGroup { if (!wrapContent) { centerHorizontal(child, params, myWidth); } else { - params.mLeft = mPaddingLeft + params.leftMargin; - params.mRight = params.mLeft + child.getMeasuredWidth(); + positionAtEdge(child, params, myWidth); } return true; } else { // This is the default case. For RTL we start from the right and for LTR we start // from the left. This will give LEFT/TOP for LTR and RIGHT/TOP for RTL. - if (isLayoutRtl()) { - params.mRight = myWidth - mPaddingRight- params.rightMargin; - params.mLeft = params.mRight - child.getMeasuredWidth(); - } else { - params.mLeft = mPaddingLeft + params.leftMargin; - params.mRight = params.mLeft + child.getMeasuredWidth(); - } + positionAtEdge(child, params, myWidth); } } return rules[ALIGN_PARENT_END] != 0; } + private void positionAtEdge(View child, LayoutParams params, int myWidth) { + if (isLayoutRtl()) { + params.mRight = myWidth - mPaddingRight - params.rightMargin; + params.mLeft = params.mRight - child.getMeasuredWidth(); + } else { + params.mLeft = mPaddingLeft + params.leftMargin; + params.mRight = params.mLeft + child.getMeasuredWidth(); + } + } + private boolean positionChildVertical(View child, LayoutParams params, int myHeight, boolean wrapContent) { diff --git a/core/res/res/layout-land/time_picker_material.xml b/core/res/res/layout-land/time_picker_material.xml index d83ccb23f64f..dc47dcf7a6ce 100644 --- a/core/res/res/layout-land/time_picker_material.xml +++ b/core/res/res/layout-land/time_picker_material.xml @@ -17,7 +17,6 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layoutDirection="ltr" android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -34,6 +33,7 @@ android:layoutDirection="ltr" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_centerHorizontal="true" android:paddingTop="@dimen/timepicker_radial_picker_top_margin" android:orientation="horizontal"> |