1
我想用拇指創建seekbar而不改變進度。我的搜索欄進度必須與拇指位置分開設置。我該怎麼做?seekbar拇指位置不等於進度
我應該說,我必須擴展Seekbar並重寫一些方法。但我不明白哪個?哪種方法確定拇指的位置?哪個決定進展?
Please help me!!
Thanks at advance!
我想用拇指創建seekbar而不改變進度。我的搜索欄進度必須與拇指位置分開設置。我該怎麼做?seekbar拇指位置不等於進度
我應該說,我必須擴展Seekbar並重寫一些方法。但我不明白哪個?哪種方法確定拇指的位置?哪個決定進展?
Please help me!!
Thanks at advance!
嘗試使用不同的drawbles
讓我告訴你一個例子:
你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);
}
}
您的問題:
你可以做的是simple
只是重命名同一繪製這樣的:
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);
}
}
這就是結果:
希望幫助!! :)