5

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 images. For example thumb which i button like image and has text and this button has tail downword, which increases with row increment.

artless noise
  • 21,212
  • 6
  • 68
  • 105

3 Answers3

15

Regarding removing the background, I managed to do this in the following way. Here, the blank drawable is a transparent png of 1x1 pixel

    <SeekBar
        android:id="@+id/bar"
        android:layout_width="fill_parent"
        android:layout_height="30dip"
        android:progressDrawable="@drawable/blank"
     />

You can also change the drawable by using:

android:thumb="@drawable/icon"

To add text, I guess you'll have to create a custom component

Arve
  • 8,058
  • 2
  • 22
  • 25
  • I used this method as well, but it seems to be a bit of a hack. There isn't a better way to do this? – dell116 Feb 01 '12 at 19:35
  • 3
    I did it by setting: android:progressDrawable="@android:color/transparent" in the xml – zwebie Aug 14 '12 at 11:23
2
  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);
Nayanesh Gupte
  • 2,735
  • 25
  • 37
-1

In order to hide the bar, you can set opacity value using hex colors. You just need to add the right prefix. I hid the seekBar using this code:

android:progressBackgroundTint="#00555555"
android:progressTint="#00555555"

Where the first two ciphers (i.e. "00") set opaqueness (alpha percentage) and the other six (i.e. "555555") set the color.

Check this post for more information and a list of hex opacity values: Understanding colors on Android (six characters)

Community
  • 1
  • 1
wraithie
  • 343
  • 1
  • 6
  • 19