摘要: 相信很多人和我一样看了官方文档对Canvas save(), restore()方法的解释还是一个头雾水,save()保存的到底是什么信息呢?答案是:坐标系的原点,坐标轴方向的信息。我们在使用Canvas时难免会用到transitoin(), rotate()方法来改变坐标系的原点和坐标轴的方向,s... 阅读全文
posted @ 2015-12-26 18:16 gatsbydhn 阅读(2176) 评论(0) 推荐(0) 编辑
摘要: Android属性动画允许开发者随着时间的流逝改变对象的属性。我们用一个小案例看下它是如何工作的。下面是官方文档提供的一张原理图:从图中可以看到ValueAnimator类封装了:一个TimeInerpolator,一个TypeEvaluator,动画执行的时间duration,属性的起始值star... 阅读全文
posted @ 2015-12-26 17:33 gatsbydhn 阅读(3562) 评论(1) 推荐(0) 编辑
摘要: 结构图:实现: 1 class SubClass1 2 { 3 public void methodOne() 4 { 5 System.out.println("子系统方法一"); 6 } 7 } 8 9 class SubClass210 {11 ... 阅读全文
posted @ 2015-12-02 22:20 gatsbydhn 阅读(365) 评论(0) 推荐(0) 编辑
摘要: 结构图:实现: 1 abstract class AbstractClass 2 { 3 abstract void primitiveOperation1(); //延迟到子类中实现 4 abstract void primitiveOperation2(); ... 阅读全文
posted @ 2015-12-01 22:47 gatsbydhn 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 结构图:实现:1 abstract public class Component {2 abstract public void operation();3 }public class ConcreteComponent extends Component { @Override ... 阅读全文
posted @ 2015-11-26 20:01 gatsbydhn 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 结构图:实现:1 abstract public class Strategy {2 public void algrithmInterface()3 { 4 }5 } 1 public class StrategyA extends Strategy{ 2 3 ... 阅读全文
posted @ 2015-11-26 19:27 gatsbydhn 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 类图:1 public interface IFactory {2 public Operation createOperation();3 }1 public class AddOperationFactory implements IFactory {2 3 @Override4... 阅读全文
posted @ 2015-11-25 21:08 gatsbydhn 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 类图:代码: 1 public class Operation { 2 3 protected double numberA = 0; 4 protected double numberB = 0; 5 6 7 public double getNumb... 阅读全文
posted @ 2015-11-25 20:37 gatsbydhn 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 问题描述:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space ... 阅读全文
posted @ 2015-11-16 22:58 gatsbydhn 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 问题描述:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1... 阅读全文
posted @ 2015-11-16 22:53 gatsbydhn 阅读(128) 评论(0) 推荐(0) 编辑