Giter VIP home page Giter VIP logo

daojishi's Introduction

关于

作者


戴定康

博客:个人博客

Csdn:戴定康的博客


SnapUpCountDownTimerView

抢购倒计时,样式可调,大小可调,Gradle引用更方便。countDown

Gradle引用

compile 'com.daidingkang:snapupcountdowntimerview:1.0.0'

在你的Xml中

<com.daidingkang.SnapUpCountDownTimerView
android:id="@+id/RushBuyCountDownTimerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
app:viewSize="12">
</com.daidingkang.SnapUpCountDownTimerView>

用法

		SnapUpCountDownTimerView rushBuyCountDownTimerView = (SnapUpCountDownTimerView) findViewById(R.id.RushBuyCountDownTimerView);
        rushBuyCountDownTimerView.setTime(1,55,3);//设置小时,分钟,秒。注意不能大于正常值,否则会抛出异常
        rushBuyCountDownTimerView.start();//开始倒计时
rushBuyCountDownTimerView.stop();//停止倒计时

So easy 是不是很简单,赶紧试试吧 喜欢的童鞋欢迎Star and Fork

当然,我们安卓自带了一个CountDownTimer类,大家可以看一看

	private TextView vertifyView;  
	    private CountDownTimer timer = new CountDownTimer(10000, 1000) {  
	  
	        @Override  
	        public void onTick(long millisUntilFinished) {  
	            vertifyView.setText((millisUntilFinished / 1000) + "秒后可重发");  
	        }  
	  
	        @Override  
	        public void onFinish() {  
	            vertifyView.setEnabled(true);  
	            vertifyView.setText("获取验证码");  
	        }  
	    }; 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.