code: @Override
      protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          int width = 200;
          if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) {
              width = MeasureSpec.getSize(widthMeasureSpec);
          }
  
          int height = thumbImage.getHeight()
                  + (!showTextAboveThumbs ? 0 : PixelUtil.dpToPx(getContext(), HEIGHT_IN_DP))
                  + (thumbShadow ? thumbShadowYOffset + thumbShadowBlur : 0);
          if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(heightMeasureSpec)) {
              height = Math.min(height, MeasureSpec.getSize(heightMeasureSpec));
          }
          setMeasuredDimension(width, height);
      }
docs: Ensures correct size of the widget.