summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2012-07-26 12:27:56 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2012-07-27 13:16:42 -0700
commita4c1030870d8c91b6d871922c3e6962323700f25 (patch)
treed4d0e805201527352d2b53e0d9b32583f3fa54ac
parent2b8c4b076d24bc7464e9be63946e8c7bd27bb360 (diff)
downloadframeworks_base-a4c1030870d8c91b6d871922c3e6962323700f25.zip
frameworks_base-a4c1030870d8c91b6d871922c3e6962323700f25.tar.gz
frameworks_base-a4c1030870d8c91b6d871922c3e6962323700f25.tar.bz2
Add removeRule() to RelativeLayout LayoutParams
- add this helper API as there are already several example of developers doing it "by hand" Change-Id: Icd15edfd75eb47de1f90f847b263b4d513c13810
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/widget/RelativeLayout.java15
2 files changed, 16 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index c910bd0..b1b0ae6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28452,6 +28452,7 @@ package android.widget {
method public void addRule(int, int);
method public java.lang.String debug(java.lang.String);
method public int[] getRules();
+ method public void removeRule(int);
field public boolean alignWithParent;
}
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index a811cc2..43519df 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -1306,6 +1306,21 @@ public class RelativeLayout extends ViewGroup {
mRulesChanged = true;
}
+ /**
+ * Removes a layout rule to be interpreted by the RelativeLayout.
+ *
+ * @param verb One of the verbs defined by
+ * {@link android.widget.RelativeLayout RelativeLayout}, such as
+ * ALIGN_WITH_PARENT_LEFT.
+ * @see #addRule(int)
+ * @see #addRule(int, int)
+ */
+ public void removeRule(int verb) {
+ mRules[verb] = 0;
+ mInitialRules[verb] = 0;
+ mRulesChanged = true;
+ }
+
private boolean hasRelativeRules() {
return (mInitialRules[START_OF] != 0 || mInitialRules[END_OF] != 0 ||
mInitialRules[ALIGN_START] != 0 || mInitialRules[ALIGN_END] != 0 ||