SeekBar Thumb position issue

前端 未结 2 1169
时光说笑
时光说笑 2020-12-30 16:15

I\'m trying to do a \"labeled\" thumb for my Seekbar. The objective is to customize a text above the thumb every time the Seekbar position changes.

I\'m doing this:

2条回答
  •  既然无缘
    2020-12-30 17:03

    Pass int progress to the method where you set drawable to the seekBar and use setProgress() method:

    private void setSeekBarLabel(String text, int progress)
    {
        BitmapDrawable thumb = Utils.writeOnBitmap(thumbBmp, text, 0, 0, thumbLablePaint);
        seekBar.setThumb(thumb);
        seekBar.setProgress(progress);
    }
    

    and add the second argument to the calling method:

    setSeekBarLabel(String.valueOf(progress), progress);
    

提交回复
热议问题