FedeZ
FedeZ

Reputation: 11

SeekBar NO initial value

I want to display a seekbar in android with no initial value. This means that there is no circle button at first, it only appears when the user taps the bar. Is this possible?

I think it should be something implying the attribute 'thumb'.

Upvotes: 0

Views: 490

Answers (3)

thando
thando

Reputation: 483

In the view class:

init {
    [...]
    seekBar.thumb.alpha = 0 // range: 0 - 255
}

In the listener class:

override fun onStartTrackingTouch(seekBar: SeekBar) {
    seekBar.thumb.alpha = 255 // range: 0 - 255
    [...]
}

Upvotes: 0

FedeZ
FedeZ

Reputation: 11

It can be done with

seekbar.setProgress(0);
Drawable transparentDrawable = new ColorDrawable(Color.TRANSPARENT);
seekbar.setThumb(transparentDrawable);

And when the user touches the seekbar (public void onStartTrackingTouch(SeekBar seekBar)) change the Thumb again.

Upvotes: 1

Sash_KP
Sash_KP

Reputation: 5591

Use this one in your layout

android:progress="0"

or Programmatically

 seekbar = (SeekBar) findViewById(R.id.yourSeekBar);
 seekbar.setProgress(0);

However this won't remove the circle of which you are talking about.This will just ensure that your SeekBar's intial value is set to 0.For other properties refer Documents.

Upvotes: 0

Related Questions