I want to create seekbar with thumb which don't change progress. Progress in my seekbar must to setting separately from thumb position. How can I do it?
I should say, I must to extends Seekbar and to override some methods. But I don't understand which??? Which method is determining position of thumb? And which is determining progress?
Please help me!!
Thanks at advance!
Try using different drawbles
Let me show you an example :
Your code
.java
import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.widget.SeekBar;
public class MainActivity extends Activity {
private SeekBar seekBar1;
private SeekBar seekBar2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seekBar1 = (SeekBar) findViewById(R.id.seekBar1);
seekBar2 = (SeekBar) findViewById(R.id.seekBar2);
seekBar1.setProgress(15);
seekBar2.setProgress(55);
Drawable ii = getResources().getDrawable(R.drawable.ii);
// Drawable iii = getResources().getDrawable(R.drawable.ii);
seekBar1.setThumb(ii);
seekBar2.setThumb(ii);
}
}
Your problem:
what you can do is simple
just rename the same drawable like this:
import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.widget.SeekBar;
public class MainActivity extends Activity {
private SeekBar seekBar1;
private SeekBar seekBar2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seekBar1 = (SeekBar) findViewById(R.id.seekBar1);
seekBar2 = (SeekBar) findViewById(R.id.seekBar2);
seekBar1.setProgress(15);
seekBar2.setProgress(55);
Drawable ii = getResources().getDrawable(R.drawable.ii);
Drawable iii = getResources().getDrawable(R.drawable.ii);
seekBar1.setThumb(ii);
seekBar2.setThumb(iii);
}
}
And that's the result:
Hope that helps!!:)