@Override protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { CustomDrawable d = (CustomDrawable) getProgressDrawable(); int thumbHeight = mThumb == null ? 0 : mThumb.getIntrinsicHeight(); int dw = 0; int dh = 0; if (d != null) { dw = d.getIntrinsicWidth(); dh = Math.max(thumbHeight, d.getIntrinsicHeight()); } dw += getPaddingLeft() + getPaddingRight(); dh += getPaddingTop() + getPaddingBottom(); setMeasuredDimension(resolveSize(dw, widthMeasureSpec), resolveSize(dh, heightMeasureSpec)); }