Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.01 KB

README.md

File metadata and controls

46 lines (32 loc) · 1.01 KB

TimerButton

Android平台下的倒计时按钮 Countdown-Button

Use in Gradle

compile 'com.cxmscb:TimerButtonLib:0.0.6'

使用方式 / Java

		private TimerButton timerButton;
		
        timerButton = (TimerButton) findViewById(R.id.timer_Button);

		timerButton.setText("获取验证码");
        timerButton.init("重 发",10000); // can set in XML

        timerButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
			
                timerButton.startTimer();
				
				//TODO YOURS
				
                //Toast.makeText(MainActivity.this,"TODO",Toast.LENGTH_SHORT).show();
				
            }
        });

XML


    <com.cxmscb.cxm.timerbuttonlib.TimerButton
        android:id="@+id/libBtn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="17sp"
        android:gravity="center"
        android:text="获取验证码"
        app:afterText="重发"
        app:ms="10000"
        />