summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fabrice Di Meglio <fdimeglio@google.com> 2013-09-04 21:26:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-09-04 21:26:55 +0000
commit3ab8e8847d723fd3b114a4c895c5eeb4623412f4 (patch)
treea3dbee1e9c774c412cb0f0da2bb03907107baffc
parent2a59f3f24076d96cbb10e1c00c3264dec43f19b1 (diff)
parent2bd961ae38ebd0acb7d33b32144a3c8a0949c023 (diff)
Merge "Fix bug #10514694 Specifying android:gravity="center_vertical|left" results in negative vertical positioning of child" into klp-dev
-rw-r--r--core/java/android/widget/RelativeLayout.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index f73e2c470880..b9b6b08f957e 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -462,6 +462,7 @@ public class RelativeLayout extends ViewGroup {
views = mSortedVerticalChildren;
count = views.length;
+ final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
for (int i = 0; i < count; i++) {
View child = views[i];
@@ -476,14 +477,26 @@ public class RelativeLayout extends ViewGroup {
if (isWrapContentWidth) {
if (isLayoutRtl()) {
- width = Math.max(width, myWidth - params.mLeft);
+ if (targetSdkVersion < Build.VERSION_CODES.KEY_LIME_PIE) {
+ width = Math.max(width, myWidth - params.mLeft);
+ } else {
+ width = Math.max(width, myWidth - params.mLeft - params.leftMargin);
+ }
} else {
- width = Math.max(width, params.mRight);
+ if (targetSdkVersion < Build.VERSION_CODES.KEY_LIME_PIE) {
+ width = Math.max(width, params.mRight);
+ } else {
+ width = Math.max(width, params.mRight + params.rightMargin);
+ }
}
}
if (isWrapContentHeight) {
- height = Math.max(height, params.mBottom);
+ if (targetSdkVersion < Build.VERSION_CODES.KEY_LIME_PIE) {
+ height = Math.max(height, params.mBottom);
+ } else {
+ height = Math.max(height, params.mBottom + params.bottomMargin);
+ }
}
if (child != ignore || verticalGravity) {