title: Thumb size reduces on SeekBar after writing text at run time
body: <p>I had implemented a custom SeekBar and set custom thumb image to that. When ever progress changes, I am displaying it on the thumb. Initially, it is being displayed correctly. When I slide it forward, backward, the thumb size is getting reduced.</p>
  <p>Here is the code for the same.</p>
  <p>XML component</p>
  <pre><code>&lt;SeekBar
                  android:id=&quot;@+id/sb_timelimit&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_gravity=&quot;center_vertical&quot;
                  android:layout_margin=&quot;5dp&quot;
                  android:max=&quot;60&quot;
                  android:maxHeight=&quot;6dp&quot;
                  android:minHeight=&quot;6dp&quot;
                  android:progress=&quot;10&quot;
                  android:progressDrawable=&quot;@drawable/timelimitprogress&quot;
                  android:thumb=&quot;@drawable/timecircle&quot; /&gt;
  </code></pre>
  <p>Layer list</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  </code></pre>
  
  <pre><code>&lt;item
      android:id=&quot;@android:id/background&quot;
      android:drawable=&quot;@drawable/greyprocessbar&quot;/&gt;
  &lt;item android:id=&quot;@android:id/progress&quot;&gt;
      &lt;scale
          android:drawable=&quot;@drawable/orangeprocessbar&quot;
          android:scaleWidth=&quot;100%&quot; /&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>Seekbar listener</p>
  <pre><code>new OnSeekBarChangeListener() {
          
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
          }
          
          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
          }
          
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress,
                  boolean fromUser) {
              int value = seekBar.getProgress(); //this is the value of the progress bar (1-100)
              //value = progress; //this should also work
              String valueString = value + &quot; sec&quot;; //this is the string that will be put above the slider
              seekBar.setThumb(writeOnDrawable(R.drawable.timecircle, valueString));
          }
      });
  
  private BitmapDrawable writeOnDrawable(int drawableId, String text){
  
      Options options = new BitmapFactory.Options();
      options.inScaled = false;
      Bitmap bm = BitmapFactory.decodeResource(getResources(), drawableId, options).copy(Bitmap.Config.ARGB_8888, true);
  
      if(paint == null){
          paint = new Paint(Paint.ANTI_ALIAS_FLAG);
      }
      paint.setStyle(Style.FILL);  
      paint.setColor(getResources().getColor(R.color.grey_text)); //Change this if you want other color of text
      paint.setTextSize(30); //Change this if you want bigger/smaller font
  
      Canvas canvas = new Canvas(bm);
      canvas.drawText(text, 10, bm.getHeight()/4, paint); //Change the position of the text here
  
      return new BitmapDrawable(bm);
  }
  </code></pre>
  <p>Reference screenshots</p>
  <p>Before seek change</p>
  <p><img src="https://i.stack.imgur.com/qNW7S.png" alt="enter image description here" /></p>
  <p>After seek change</p>
  <p><img src="https://i.stack.imgur.com/uJjtc.png" alt="enter image description here" /></p>
  <p>Any one has idea about how to resolve this issue? Thanks in advance.</p>