Android SeekBar thumb Customization

前端 未结 3 729
故里飘歌
故里飘歌 2021-01-03 05:08

I want to hide bar and only want to show thumb. I did it with max-height=0dip but it did not completely work. I also want to set text on thumb and create thumb with multiple

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 05:23

      SeekBar seekbar = new SeekBar(context, attrs);
    
         // ------------- custom thumb
                //----- using resources 
    
        seekbar.setThumb(new BitmapDrawable(BitmapFactory.decodeResource(
             context.getResources(), R.drawable.seekbar_progress_thumb)));
              //----- or using shape drawable
    
    
        ShapeDrawable thumb = new ShapeDrawable(new RectShape());
        thumb.getPaint().setColor(Color.rgb(0, 0, 0));
        thumb.setIntrinsicHeight(-80);
        thumb.setIntrinsicWidth(30);
        seekbar.setThumb(thumb);
    

提交回复
热议问题