用漂亮的方式描述Android应用程序的持续时间

网友投稿 559 2022-10-26

用漂亮的方式描述Android应用程序的持续时间

用漂亮的方式描述Android应用程序的持续时间

Duration View

Duration View allows you to create views to depict durations of time.

For example, if you wish to display a duration split into Days, Hours, Mins and Secs, you just need to set the values and DurationView will do the rendering for you.

Sample App

Download the Demo app on Google Play Store:

Installation

Gradle

Add JitPack in your root build.gradle at the end of repositories:

allprojects { repositories { ... maven { url 'https://jitpack.io' } }}

Add it as a dependency in your app's build.gradle file

dependencies { implementation 'com.github.rayzone107:DurationView:1.00'}

How to use

Add a DurationView to your XML layout

Below are the default values for all the properties

\\ Divider width

Note that "wrap_content" might not function properly. wrap_content and match_parent might work the same way. Either set absolute dimensions in dp, or set match_parent with limited available area (within a ViewGroup).

These values can also be set programatically.

DurationView durationView = findViewById(R.id.duration_view); durationView.setDays(rnd.nextInt(100)); durationView.setHours(rnd.nextInt(24)); durationView.setMins(rnd.nextInt(60)); durationView.setSecs(rnd.nextInt(60)); durationView.setDaysColor(Color.BLACK); durationView.setHoursColor(Color.BLACK); durationView.setMinsColor(Color.BLACK); durationView.setSecsColor(Color.BLACK); durationView.setDaysLabelColor(Color.BLACK); durationView.setHoursLabelColor(Color.BLACK); durationView.setMinsLabelColor(Color.BLACK); durationView.setSecsLabelColor(Color.BLACK); durationView.setLabelTextSize(10f); durationView.setNumberTextSize(18f); durationView.setShowDividers(true); durationView.setDividersColor(Color.BLACK); durationView.setDividersMargin(2f); durationView.setDividersWidth(2f);

Contribution

Any kind of contribution will be appreciated; feel free to create a pull request or file issues on the issue tracker.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:一个Android库很容易在Android应用程序创建树菜单
下一篇:spring controller层引用service报空指针异常nullpointExceptio问题
相关文章

 发表评论

暂时没有评论,来抢沙发吧~