diff options
Diffstat (limited to 'core/java/android/widget/ImageView.java')
-rw-r--r-- | core/java/android/widget/ImageView.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index f259597..87396fb 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -342,8 +342,15 @@ public class ImageView extends View { updateDrawable(null); mResource = resId; mUri = null; + + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; + resolveUri(); - requestLayout(); + + if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) { + requestLayout(); + } invalidate(); } } @@ -367,8 +374,15 @@ public class ImageView extends View { updateDrawable(null); mResource = 0; mUri = uri; + + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; + resolveUri(); - requestLayout(); + + if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) { + requestLayout(); + } invalidate(); } } @@ -383,8 +397,8 @@ public class ImageView extends View { mResource = 0; mUri = null; - int oldWidth = mDrawableWidth; - int oldHeight = mDrawableHeight; + final int oldWidth = mDrawableWidth; + final int oldHeight = mDrawableHeight; updateDrawable(drawable); |