美文网首页
无标题文章

无标题文章

作者: CallMeInk | 来源:发表于2017-09-09 16:09 被阅读0次

    packagecom.example.yu_k.seekbartest;

    importandroid.support.v7.app.AppCompatActivity;

    importandroid.os.Bundle;

    importandroid.widget.SeekBar;

    importandroid.widget.TextView;

    importjava.util.ArrayList;

    public classMainActivityextendsAppCompatActivity {

    privateSeekBarmSeekBar;

    privateTextViewmTextView;

    privateTextViewmTextView2;

    @Override

    protected voidonCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    mSeekBar= (SeekBar) findViewById(R.id.seekBar);

    mTextView= (TextView) findViewById(R.id.tv);

    mTextView2= (TextView) findViewById(R.id.tv2);

    mSeekBar.setOnSeekBarChangeListener(newSeekBar.OnSeekBarChangeListener() {

    @Override

    public voidonProgressChanged(SeekBar seekBar,intprogress,booleanfromUser) {

    mTextView.setText("当前进度:"+ progress);

    }

    @Override

    public voidonStartTrackingTouch(SeekBar seekBar) {

    mTextView2.setText("press down");

    }

    @Override

    public voidonStopTrackingTouch(SeekBar seekBar) {

    mTextView2.setText("press up");

    }

    });

    }

    }

    相关文章

      网友评论

          本文标题:无标题文章

          本文链接:https://www.haomeiwen.com/subject/ymfajxtx.html