SeekBar进度条滑块

package com.SeekBarDemo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.SeekBar;

public class MainActivity extends Activity {
   /** Called when the activity is first created. */
  SeekBar seekBar;

  @Override
   public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    seekBar = (SeekBar) findViewById(R.id.seekBar1);
     // 设置进度条的最大值
    seekBar.setMax(100);
    seekBar.setOnSeekBarChangeListener( new SeekBarListenner());
  }

   class SeekBarListenner implements SeekBar.OnSeekBarChangeListener {
     // 监听器负责进度条的改变
     public void onProgressChanged(SeekBar seekBar, int progress,
         boolean fromUser) {
       // 当进度条的状态发生变化时会调用此方法
      System.out.println( "A进度条在滑动过程中的改变值----->" + progress);

    }

     public void onStartTrackingTouch(SeekBar seekBar) {
       // TODO Auto-generated method stub
      System.out.println( "B滑块开始滑动时的进度--->" + seekBar.getProgress());

    }

     public void onStopTrackingTouch(SeekBar seekBar) {
       // TODO Auto-generated method stub
      System.out.println( "C滑块停止滑动后的进度--->" + seekBar.getProgress());
    }

  }

}

你可能感兴趣的:(seekbar,进度条滑块)