2 armyfight armyfight 于 2014.10.15 11:12 提问

Eclipse写Android程序时设置监听器总是提错

bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        public void onStopTrackingTouch(SeekBar bar) {
            current=bar.getProgress();
            show="结束拖动,当前进度为:"+String.valueOf(current);
            Toast.makeText(getBaseContext(), show, Toast.LENGTH_LONG);
            show();

        }

        public void onStartTrackingTouch(SeekBar bar) {
            // TODO Auto-generated method stub
              current=bar.getProgress();
              show="开始拖动,当前进度为:"+String.valueOf(current);
              Toast.makeText(getBaseContext(), show, Toast.LENGTH_LONG);
              show();


        }

        public void onProgressChanged(SeekBar bar, int current, boolean arg2) {
            // TODO Auto-generated method stub
            show="进度条改变中。。。"+String.valueOf(current);
            Toast.makeText(getBaseContext(), show, Toast.LENGTH_LONG);
            show();
        }
    });

Blockquote
总是提示Multiple markers at this line
- The method setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener) in the type
SeekBar is not applicable for the arguments (new OnSeekBarChangeListener(){})
- OnSeekBarChangeListener cannot be resolved to a type
- Line breakpoint:MainActivity [line: 19] - onCreate(Bundle)
怎么解决,这种监听器设置方法不行吗?之前的spinner的也是这样的错误

1个回答

hemi1995
hemi1995   2015.01.26 10:40

```import android.widget.SeekBar.OnSeekBarChangeListener;

插入这个就OK了

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!