Giter VIP home page Giter VIP logo

clockview's Introduction

ClockView

一个自定义的动态时钟View,可根据自己的需求完成各种颜色的搭配,大小设置。

效果图

GIF演示图

效果图

样式效果演示图

效果图 效果图 效果图

基本使用

1.在gradle中添加依赖

compile 'com.don:clockviewlibrary:1.0.1'

2.布局中使用

使用默认的样式,其中宽高可根据自己的需求设置,支持wrap_content,match_parent,固定尺寸

<com.don.clockviewlibrary.ClockView
    android:id="@+id/clockView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

自定义样式,根据自己的需求设置各种颜色

<com.don.clockviewlibrary.ClockView
    android:layout_width="150dp"
    android:layout_height="150dp"
    don:circle_color="@android:color/holo_blue_light"
    don:hour_color="#ff00ff"
    don:minute_color="@android:color/holo_red_light"
    don:minute_mark_color="@android:color/white"
    don:quarter_mark_color="@android:color/black"
    don:second_color="@android:color/holo_green_light" 
	don:draw_center_circle="true"/>
  • circle_color:时钟的背景颜色(圆的颜色)

  • hour_color:时针的颜色

  • minute_color:分针的颜色

  • second_color:秒针的颜色

  • minute_mark_color:分钟刻度线的颜色

  • quarter_mark_color:一刻钟刻度线的颜色

  • draw_center_circle:是否绘制3个指针的圆心

3.代码中可设置时间的监听

ClockView clockView = (ClockView) findViewById(R.id.clockView);
clockView.setOnCurrentTimeListener(new ClockView.OnCurrentTimeListener() {
        @Override
        public void currentTime(String time) {
            Log.i("MyLog", time);
        }
    });

实现解析

关于项目的实现方式,大家可以参考我的博客Android自定义控件:时钟,里面有详细的绘制分析

更新日志

V1.0.1

  • 添加是否绘制中心圆的属性draw_center_circle

V1.0.0

  • 动态时钟View

License

    Copyright 2016 zhijieeeeee

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

clockview's People

Contributors

zhijieeeeee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clockview's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.