Skip to content

Commit b1271ac

Browse files
committed
Fix adjustViewBounds handling for ImageView
When computing the adjusted view bounds, don't constrain the dimensions by the original estimate. This can result in the view never getting properly enlarged. Bug 7240251 Change-Id: I44fc017f8b661121f0042fcd59a4efde70be6bbe
1 parent 4368ba4 commit b1271ac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/java/android/widget/ImageView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
789789
if (resizeWidth) {
790790
int newWidth = (int)(desiredAspect * (heightSize - ptop - pbottom)) +
791791
pleft + pright;
792+
widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec);
792793
if (newWidth <= widthSize) {
793794
widthSize = newWidth;
794795
done = true;
@@ -799,6 +800,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
799800
if (!done && resizeHeight) {
800801
int newHeight = (int)((widthSize - pleft - pright) / desiredAspect) +
801802
ptop + pbottom;
803+
heightSize = resolveAdjustedSize(newHeight, mMaxHeight, heightMeasureSpec);
802804
if (newHeight <= heightSize) {
803805
heightSize = newHeight;
804806
}

0 commit comments

Comments
 (0)