码迷,mamicode.com
首页 > 其他好文 > 详细

初识SeekBar

时间:2014-12-26 06:12:34      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:

SeekBar拖动条,是Progress的间接子类

1 <SeekBar
2             android:id="@+id/seekBar1"
3             android:layout_width="match_parent"
4             android:layout_height="wrap_content"
5             android:progress="30"
6             //Draws the thumb on a seekbar. 
7             android:thumb="@drawable/peasy" />

SeekBar事件,被拉动时,onProgressChanged会一直被触发


 1 public void showSeekBar() {
 2         seekBar = (SeekBar) findViewById(R.id.seekBar1);
 3         seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
 4 
 5             @Override
 6             public void onStopTrackingTouch(SeekBar seekBar) {
 7                 // TODO Auto-generated method stub
 8                 Log.i(TAG, "onStopTrackingTouch");
 9                 Toast.makeText(FormActivity.this,
10                         "current level is " + seekBar.getProgress(), 3000)
11                         .show();
12             }
13 
14             @Override
15             public void onStartTrackingTouch(SeekBar seekBar) {
16                 // TODO Auto-generated method stub
17                 Log.i(TAG, "onStartTrackingTouch");
18 
19             }
20 
21             @Override
22             public void onProgressChanged(SeekBar seekBar, int progress,
23                     boolean fromUser) {
24                 // TODO Auto-generated method stub
25                 Log.i(TAG, "onProgressChanged");
26 
27             }
28         });
29     }

 

初识SeekBar

标签:

原文地址:http://www.cnblogs.com/izhanjun/p/4185946.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!