WhiteDG / Countdownbutton
Licence: mit
⏳A button component with a countdown function
Stars: ✭ 87
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Countdownbutton
Efcountinglabel
Adds animated counting support to UILabel.
Stars: ✭ 311 (+257.47%)
Mutual labels: button, countdown
Wymaterialbutton
Interactive and fully animated Material Design button for iOS developers.
Stars: ✭ 80 (-8.05%)
Mutual labels: button
Ripple Without Js
Create Material Design ripple effect in your HTML without using a single line of JS.
Stars: ✭ 53 (-39.08%)
Mutual labels: button
React Countdown
React Component showing a countdown to certain date and time.
Stars: ✭ 58 (-33.33%)
Mutual labels: countdown
Flip Clock
A flip clock, timer and countdown made with Polymer
Stars: ✭ 69 (-20.69%)
Mutual labels: countdown
Statebutton
一个可以用代码设置selector背景(按下去背景颜色更改,样式变化等等)的button, 再也不用写selector了
Stars: ✭ 1,276 (+1366.67%)
Mutual labels: button
React Native Selectmultiple Button
A button (or a grouped buttons) supporting multiple or radio selection by building with React Native. https://github.com/danceyoung/selectmultiplebuttons for Swift.
Stars: ✭ 72 (-17.24%)
Mutual labels: button
Transitionbutton
UIButton sublass for loading and transition animation.
Stars: ✭ 1,124 (+1191.95%)
Mutual labels: button
Floating Navigation View
A simple Floating Action Button that shows an anchored Navigation View
Stars: ✭ 1,169 (+1243.68%)
Mutual labels: button
React Native Timer Countdown
⏱ A minimal and customizable countdown timer for React Native (iOS and Android)
Stars: ✭ 53 (-39.08%)
Mutual labels: countdown
React Planet
A react lib for building circular menus in a very easy and handy way.
Stars: ✭ 83 (-4.6%)
Mutual labels: button
Fitbutton
The button which can use with icon, text, divider, custom ripple effect, border, corner radius e.t.c.
Stars: ✭ 63 (-27.59%)
Mutual labels: button
P5.clickable
Event driven, easy-to-use button library for P5.js 👆
Stars: ✭ 66 (-24.14%)
Mutual labels: button
React Native Circle Button
A Customizable React Native Circle Button
Stars: ✭ 87 (+0%)
Mutual labels: button
Angular2 Promise Buttons
Chilled loading buttons for angular2
Stars: ✭ 84 (-3.45%)
Mutual labels: button
CountDownButton
CountDownButton是一个具有倒计时功能的自定义按钮
下载
dependencies {
compile 'com.white.countdownbutton:countdownbtn:1.0.4'
}
使用
// 布局文件:
<com.white.countdownbutton.CountDownButton
android:id="@+id/cd_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="get verifyCode"
app:countDown="60000"
app:countDownFormat="Please wait (%ds)"
app:countDownInterval="1000"
app:enableCountDown="true"
app:cdFinishText="重新获取验证码"
/>
// Activity代码:
...
mCountDownButton = (CountDownButton) findViewById(R.id.cd_btn);
// 设置点击事件
mCountDownButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 点击按钮要执行的操作,同时开始倒计时
Toast.makeText(activity, "click countdown button", Toast.LENGTH_SHORT).show();
}
});
mBtnStop = (Button) findViewById(R.id.btn_stop)
mBtnStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 调用removeCountDown()即可取消当前倒计时
mCountDownButton.removeCountDown();
}
});
属性和方法
你可以在在xml中配置的属性
属性 | 说明 |
---|---|
countDown | 倒计时总时长(单位为毫秒),默认60000毫秒 |
countDownFormat | 倒计时过程中按钮文本的格式,默认"%d",直接显示剩余秒数 |
countDownInterval | 倒计时间隔(单位为毫秒),默认1000毫秒 |
enableCountDown | 倒计时是否可用,默认为true |
cdFinishText | 倒计时结束后按钮上显示的文本,默认为原始文本 |
你可以通过以下方法在代码中动态设置相关的属性
方法 | 说明 |
---|---|
setEnableCountDown(boolean enableCountDown) | 设置倒计时是否可用 |
setCountDownFormat(String countDownFormat) | 设置倒计时过程中按钮文本的格式 |
setCount(long count) | 设置倒计时总时长,单位为毫秒 |
setInterval(long interval) | 设置倒计时间隔,单位为毫秒 |
setCountDown(long count, long interval, String countDownFormat) | 同时设置三个属性 |
setCDFinishText(String cdFinishText) | 设置倒计时结束后按钮上显示的文本 |
isCountDownNow() | 是否正在倒计时 |
removeCountDown() | 取消倒计时 |
Licence
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].