1 Star 0 Fork 4

卑微的沉默 / CountdownView

forked from HarmonyOS-TPC / CountdownView 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

CountDownView

CountDownView是一个具有倒计时功能的View,满足大多数倒计时控件需求

主要特征

  • 支持修改倒计时背景颜色
  • 支持修改倒计时数字颜色
  • 支持倒计时分割符自定义
  • 支持倒计时边框圆角修改

演示

无背景倒计时 有背景倒计时 列表倒计时使用

图片过大需要登陆后可见

entry运行要求

通过DevEco studio,并下载openHarmonySDK 将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本)

集成

方式一:
通过library生成har包,添加har包到libs文件夹内
在entry的gradle内添加如下代码
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])

方式二:
allprojects{
    repositories{
        mavenCentral()
    }
}
implementation 'io.openharmony.tpc.thirdlib:countdownview:1.0.1'

CountdownView使用说明:

代码使用

CountdownView mCvCountdownView = (CountdownView)findViewById(R.id.cv_countdownViewTest1);
mCvCountdownView.start(995550000); // Millisecond

布局使用

<cn.iwgang.example.CountdownView
        ohos:id="$+id:cv_countdownViewTest1"
        ohos:width="match_content"
        ohos:height="match_content"
        ohos:layout_alignment="horizontal_center"
        ohos:top_margin="20vp"
        ohos:isHideTimeBackground="false"
        ohos:isShowDay="false"
        ohos:isShowHour="true"
        ohos:isShowMillisecond="false"
        ohos:isShowMinute="true"
        ohos:isShowSecond="true"
        ohos:isShowTimeBgDivisionLine="false"
        ohos:suffixGravity="center"
        ohos:suffixTextColor="#000000"
        ohos:suffixTextSize="20vp"
        ohos:timeBgColor="#FF5000"
        ohos:timeTextColor="#FFFFFF"
        ohos:timeTextSize="20vp"/>

自定义属性

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,否则列表条目宽高展示会有问题

The MIT License (MIT) Copyright (c) 2015 iWgang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

CountDownView是一个具有倒计时功能的View,满足大多数倒计时控件需求 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/humble-silence/CountdownView.git
git@gitee.com:humble-silence/CountdownView.git
humble-silence
CountdownView
CountdownView
master

搜索帮助

14c37bed 8189591 565d56ea 8189591