06 2017 档案

摘要:说起单例模式,大家都不陌生,它是简单而又经常用的设计模式之一。但是,你真的会用单例模式吗? 完美的单例模式 (1)单例(ps:废话,看名字就知道啦~) (2)延迟加载 (3)线程安全 (4)没有性能问题 (5)防止反序列化产生新对象 单例模式的实现方式 通常它的实现方式有两种: 1、饿汉式:在定义变 阅读全文
posted @ 2017-06-29 13:01 ha_cjy 阅读(239) 评论(0) 推荐(0)
摘要:Android O (8.0) 新特性 Android 7.0 新特性 Android 6.0新特性 Android 5.0新特性 阅读全文
posted @ 2017-06-16 11:39 ha_cjy 阅读(157) 评论(0) 推荐(0)
摘要:一、背景介绍 我们在项目中,经常会见到圆形进度条,看起来很美观、直观。刚好最近项目中有这样的需求,记录一下,顺便回顾下自定义View的知识。 二、实现思路 自定义View,就是在画布中绘制View,需要重写onDraw方法。该View可以拆分成以下几部分: 1)需要画一个浅绿色的圆 2)需要画一个白 阅读全文
posted @ 2017-06-16 10:46 ha_cjy 阅读(3270) 评论(0) 推荐(0)
摘要:int circleXY = (int) (mWidth / 2); int circleRadius = (int) ((mWidth * 0.5) / 2) + 20; //计算文本宽度 int textWidth = getTextWidth(mTextPaint,mText); //计算baseline:垂直... 阅读全文
posted @ 2017-06-15 15:01 ha_cjy 阅读(2098) 评论(0) 推荐(0)
摘要:/** * 方法1:获取文本的宽度 * @param paint * @param str * @return */ public static int getTextWidth(Paint paint, String str) { int iRet = 0; if (str != null && str.... 阅读全文
posted @ 2017-06-15 14:59 ha_cjy 阅读(358) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/javazejian/article/category/6077865 阅读全文
posted @ 2017-06-09 15:15 ha_cjy 阅读(193) 评论(0) 推荐(0)