Android Studio countdowntimer seekbar?

时间:2015-07-17 06:44:40

标签: android seekbar countdowntimer

我在android studio中做了倒数计时器。它有一个显示其进度的进度条。但是,我想要一个搜索栏来寻找倒计时中的特定时间。我不知道该怎么做。 我希望能够拖动搜索条和倒数计时器进行相应的更改。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我之前已经完成了这么多时间..幸运的是有源于此......

mTxtTime = (TextView) findViewById(R.id.txt_time);
    mSkbCountDown = (SeekBar) findViewById(R.id.count_down);
    mSkbCountDown.setProgress(mSkbCountDown.getMax());

    new MyCountDown(100000, 1000).start();

 public class MyCountDown extends CountDownTimer {

    public MyCountDown(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        mSkbCountDown.setMax((int) millisInFuture);
    }

    @Override
    public void onFinish() {
        mTxtTime.setText("It Finished...!!");
    }

    @Override
    public void onTick(long millisUntilFinished) {
        long timeRemaining = millisUntilFinished;
        mTxtTime.setText(" " + millisUntilFinished / 1000 + "."+ millisUntilFinished % 1000);
        mSkbCountDown.setProgress((int) (timeRemaining));
        //Log.i(TAG, "Time tick: " + millisUntilFinished);
    }

这可以帮助你......和我一起工作......