diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-03-07 16:20:22 -0800 |
|---|---|---|
| committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-03-08 12:12:34 -0800 |
| commit | bf923ebb250a112266bd9bcae106cb84f42b6f15 (patch) | |
| tree | ab1989bf9dbbe14f8082abc01f75ecd0e7fe8985 /core/java/android | |
| parent | 3bef5e9f3aa90465ee3ab66ef33d7a88d1b0c5c1 (diff) | |
More fixes about padding
- take care of overridig setPaddingRelative() too in TextView subclasses
Change-Id: If2057247cfcac919d777846def4adfeb5a682d51
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/widget/CheckedTextView.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 603cea1cdef9..19fb7b17794c 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -161,6 +161,12 @@ public class CheckedTextView extends TextView implements Checkable { } @Override + public void setPaddingRelative(int start, int top, int end, int bottom) { + super.setPaddingRelative(start, top, end, bottom); + mBasePadding = getPaddingEnd(); + } + + @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 47e10cca358c..5ee739290c0d 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -2079,6 +2079,20 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener invalidate(); } + @Override + public void setPaddingRelative(int start, int top, int end, int bottom) { + if (start != getPaddingStart() || + end != getPaddingEnd() || + top != mPaddingTop || + bottom != mPaddingBottom) { + nullLayouts(); + } + + // the super call will requestLayout() + super.setPaddingRelative(start, top, end, bottom); + invalidate(); + } + /** * Gets the autolink mask of the text. See {@link * android.text.util.Linkify#ALL Linkify.ALL} and peers for |
