/** max -- 最大值 progress -- 當前值 自定義樣式,從style找到seekbar源碼查看其屬性,例如複寫thumb.xml滑塊(替換裏面的資源圖片)便可 */ <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/seekbar" android:max="100" android:progress="50" /> ====== public class SeekBarActivity extends Activity implements SeekBar.OnSeekBarChangeListener{ private SeekBar seekBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_seekbar); seekBar = (SeekBar)findViewById(R.id.seekbar); seekBar.setOnSeekBarChangeListener(this); } //數值改變時 @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { } //開始拖拽 @Override public void onStartTrackingTouch(SeekBar seekBar) { } //結束拖拽 @Override public void onStopTrackingTouch(SeekBar seekBar) { } }