
回复
CountDownView是一个具有倒计时功能的View,满足大多数倒计时控件需求
无背景倒计时 | 有背景倒计时 | 列表倒计时使用 |
![]() |
![]() |
|
通过DevEco studio,并下载openHarmonySDK 将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本)
CountdownView使用说明:
attr | type | default |
---|---|---|
isHideTimeBackground | boolean | true |
timeBgColor | color | #444444 |
timeBgSize | dimension | timeSize + 2vp * 4 |
timeBgRadius | dimension | 0 |
isShowTimeBgDivisionLine | boolean | true |
timeBgDivisionLineColor | color | #30FFFFFF |
timeBgDivisionLineSize | dimension | 0.5vp |
timeTextSize | dimension | 12fp |
timeTextColor | color | #000000 |
isTimeTextBold | boolean | false |
isShowDay | boolean | auto show (has value show if not hide) |
isShowHour | boolean | auto show (has value show if not hide) |
isShowMinute | boolean | true |
isShowSecond | boolean | true |
isShowMillisecond | boolean | false |
isConvertDaysToHours | boolean | false |
suffixTextSize | dimension | 12fp |
suffixTextColor | color | #000000 |
isSuffixTextBold | boolean | false |
suffixGravity | 'top' or 'center' or 'bottom' | 'center' |
suffix | string | ':' |
suffixDay | string | null |
suffixHour | string | null |
suffixMinute | string | null |
suffixSecond | string | null |
suffixMillisecond | string | null |
suffixLRMargin | dimension | left 3vp right 3vp |
suffixDayLeftMargin | dimension | 0 |
suffixDayRightMargin | dimension | 0 |
suffixHourLeftMargin | dimension | 0 |
suffixHourRightMargin | dimension | 0 |
suffixMinuteLeftMargin | dimension | 0 |
suffixMinuteRightMargin | dimension | 0 |
suffixSecondLeftMargin | dimension | 0 |
suffixSecondRightMargin | dimension | 0 |
suffixMillisecondLeftMargin | dimension | 0 |
isShowTimeBgBorder | boolean | false |
timeBgBorderColor | color | #000000 |
timeBgBorderSize | dimension | 1vp |
timeBgBorderRadius | dimension | 0 |
配合listcontainer使用时,countdownview的宽高要给精确值, 不能使用match_content,否则列表条目宽高展示会有问题