绘制模拟Android钟 ####时钟表盘
来源:互联网 发布:tensorflow vgg 编辑:程序博客网 时间:2024/05/01 04:48
protected void onDraw(Canvas canvas) { super.onDraw(canvas); //绘制时钟的外圈, circlePaint.setColor(circleColor01); canvas.drawCircle(this.getWidth() / 2, this.getHeight() / 2, this.getWidth() / 2, circlePaint); circlePaint.setColor(circleColor02); canvas.drawCircle(this.getWidth() / 2, this.getHeight() / 2, this.getWidth() / 2 - circleWidth, circlePaint); //绘制时钟的表盘 canvas.save(); for (int i=0;i<12;i++) { canvas.drawLine(this.getWidth()/2,20*density, this.getWidth()/2,circleWidth + 1*density,linePaint); canvas.rotate(30,this.getWidth()/2,this.getHeight()/2); } canvas.restore(); //刻度值数字 //绘制小时,分钟和秒数针 canvas.save(); canvas.rotate(hour * 30 + minute / 2, this.getWidth() / 2, this.getHeight() / 2); timerPaint.setStrokeWidth(5.0f * density); canvas.drawLine(this.getWidth() / 2, this.getHeight() / 2, this.getWidth() / 2, circleWidth + (this.getHeight() / 5) * density, timerPaint); canvas.restore(); canvas.save(); canvas.rotate(minute * 6, this.getWidth() / 2, this.getHeight() / 2); timerPaint.setStrokeWidth(4.0f * density); canvas.drawLine(this.getWidth() / 2, this.getHeight() / 2, this.getWidth() / 2, circleWidth + (this.getHeight() / 7) * density, timerPaint); canvas.restore(); canvas.save(); canvas.rotate(second * 6,this.getWidth()/2,this.getHeight()/2); timerPaint.setStrokeWidth(3.0f*density); canvas.drawLine(this.getWidth()/2,this.getHeight()/2, this.getWidth()/2,circleWidth+(this.getHeight()/9)*density,timerPaint); canvas.restore(); }
<img src="http://img.blog.csdn.net/20160315232136063?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />
0 0
- 绘制模拟Android钟 ####时钟表盘
- android studio 绘制时钟刻度表盘的虚拟动画。
- 自定义时钟View,表盘的绘制
- 表盘绘制
- Canvas的初识——模拟表盘数字绘制
- android 利用环形菜单制作带数字表盘的时钟
- 时钟表盘代码
- 时钟表盘代码
- 图形界面 时钟表盘
- CSS3简易表盘时钟
- Android绘制时钟
- 利用canvas.save()、canvas.restore()、canvas.translate()、canvas.rotate()绘制一个时钟表盘
- Android模拟时钟
- MTK中模拟时钟的绘制
- MTK中模拟时钟的绘制
- 使用Canvas绘制圆形表盘
- android模拟摇杆绘制
- Android 自定义模拟时钟控件
- uva 11584 Partitioning by Palindromes
- 深入浅出ClassLoader
- /* 判断一个对象是不是数组*/
- hadoop 2.7.2开发环境配置
- hdu——1106排序(重定向)
- 绘制模拟Android钟 ####时钟表盘
- Linux命令对应的全称解释
- python学习之常用的内置类(4):python中的XML
- Android 防内存泄露handler
- Leetcode #12 & #13 Integer to Roman & Roman to Integer 解题小节
- js惰性载入-性能-滚轮事件
- git创建项目并上传代码
- Spring AOP原理解释
- Blcoking I/O & NonBlocking I/O