Skip to content

Commit a7f7e2a

Browse files
author
NoraBora
committed
guess default mMaxHeight but allow layout to override this.
without this code, progress bar height gets smaller when thumb gets bigger in AbsSeekBar.java onSizeChanged().
1 parent 51207b1 commit a7f7e2a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/java/android/widget/ProgressBar.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public ProgressBar(Context context, AttributeSet attrs, int defStyle) {
177177
Drawable drawable = a.getDrawable(R.styleable.ProgressBar_progressDrawable);
178178
if (drawable != null) {
179179
drawable = tileify(drawable, false);
180+
// guess mMaxHeight. but allow XML layout to override this.
180181
setProgressDrawable(drawable);
181182
}
182183

@@ -421,6 +422,13 @@ public Drawable getProgressDrawable() {
421422
public void setProgressDrawable(Drawable d) {
422423
if (d != null) {
423424
d.setCallback(this);
425+
426+
// without this code, progress bar height will be updated.
427+
int drawableHeight = drawable.getMinimumHeight();
428+
if (mMaxHeight < drawableHeight) {
429+
mMaxHeight = drawableHeight;
430+
requestLayout();
431+
}
424432
}
425433
mProgressDrawable = d;
426434
if (!mIndeterminate) {

0 commit comments

Comments
 (0)