Merge "Fix and clarify behavior of vertical/horizontal attributes" into oc-dev am: 68311f8712
am: 4b35637a4a
Change-Id: If37d42fffcd17cec5e00f92c8a24215cc5425751
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 54187d3..c5d4ed2 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -57,6 +57,7 @@
import android.view.animation.AnimationUtils;
import android.view.animation.LayoutAnimationController;
import android.view.animation.Transformation;
+
import com.android.internal.R;
import java.util.ArrayList;
@@ -7716,14 +7717,15 @@
mMarginFlags |= RIGHT_MARGIN_UNDEFINED_MASK;
rightMargin = DEFAULT_MARGIN_RESOLVED;
}
- startMargin = a.getDimensionPixelSize(
- R.styleable.ViewGroup_MarginLayout_layout_marginStart,
- DEFAULT_MARGIN_RELATIVE);
- endMargin = a.getDimensionPixelSize(
- R.styleable.ViewGroup_MarginLayout_layout_marginEnd,
- DEFAULT_MARGIN_RELATIVE);
}
+ startMargin = a.getDimensionPixelSize(
+ R.styleable.ViewGroup_MarginLayout_layout_marginStart,
+ DEFAULT_MARGIN_RELATIVE);
+ endMargin = a.getDimensionPixelSize(
+ R.styleable.ViewGroup_MarginLayout_layout_marginEnd,
+ DEFAULT_MARGIN_RELATIVE);
+
if (verticalMargin >= 0) {
topMargin = verticalMargin;
bottomMargin = verticalMargin;
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index cfe25b3..79bb109 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2290,8 +2290,9 @@
<!-- Sets the padding, in pixels, of all four edges. Padding is defined as
space between the edges of the view and the view's content. This value will take
- precedence over any of the edge-specific values, including
- paddingHorizontal and paddingVertical, if set. A view's size
+ precedence over any of the edge-specific values (paddingLeft, paddingTop,
+ paddingRight, paddingBottom, paddingHorizontal and paddingVertical), but will
+ not override paddingStart or paddingEnd, if set. A view's size
will include its padding. If a {@link android.R.attr#background}
is provided, the padding will initially be set to that (0 if the
drawable does not have padding). Explicitly setting a padding value
@@ -2299,7 +2300,7 @@
<attr name="padding" format="dimension" />
<!-- Sets the padding, in pixels, of the left and right edges; see
{@link android.R.attr#padding}. This value will take precedence over
- paddingLeft, paddingRight, paddingStart, and paddingEnd, if set. -->
+ paddingLeft and paddingRight, but not paddingStart or paddingEnd (if set). -->
<attr name="paddingHorizontal" format="dimension" />
<!-- Sets the padding, in pixels, of the top and bottom edges; see
{@link android.R.attr#padding}. This value will take precedence over
@@ -3203,11 +3204,10 @@
<attr name="layout_marginEnd" format="dimension" />
<!-- Specifies extra space on the left and right sides of this view.
Specifying layout_marginHorizontal is equivalent to specifying
- either layout_marginLeft and layout_marginRight or
- layout_marginStart and layout_marginEnd with that same value.
- If both layout_marginHorizontal and any of layout_marginLeft,
- layout_marginRight, layout_marginStart, and layout_marginEnd are
- also specified, the layout_marginHorizontal value will take precedence over the
+ layout_marginLeft and layout_marginRight.
+ If both layout_marginHorizontal and either/both of layout_marginLeft
+ and layout_marginRight are also specified, the layout_marginHorizontal
+ value will take precedence over the
edge-specific values. Also, layout_margin will always take precedence over
any of these values, including layout_marginHorizontal.
This space is outside this view's bounds.
@@ -3216,7 +3216,7 @@
<!-- Specifies extra space on the top and bottom sides of this view.
Specifying layout_marginVertical is equivalent to specifying
layout_marginTop and layout_marginBottom with that same value.
- If both layout_marginVertical and either/both layout_marginTop and
+ If both layout_marginVertical and either/both of layout_marginTop and
layout_marginBottom are also specified, the layout_marginVertical value
will take precedence over the edge-specific values.
Also, layout_margin will always take precedence over