自定义实现个Factory,可以用来解析自定义的属性.public interface Factory { /** * Hook you can supply that is called when inflating from a LayoutInflater. * You can use this to customize the tag names available in your XML * layout files. * * <p> * Note that it is good p…
public interface Car { void run(); } public class Audi implements Car { @Override public void run() { System.out.println("奥迪再跑!"); } } public class Byd implements Car { @Override public void run() { System.out.println("比亚迪再跑!"); } } pu…
大神勿喷,不对的地方请指出来,学笔记而已. 解决的问题:应对多系列对象构建的变化或多系列(例如:崎岖的山路和平坦的马路属于一个系列) 不断的变化的创建. 使用场景:对象不变(比如有3个对象 "路, 房子, 湖" 这些不能有增加或者减少),系列经常变,并且比较多(”路“对象 包含崎岖的山路和平坦的马路等) 针对上图用代码表示: public abstract class AbstractProductA { } public abstract class AbstractProductB…