- 博客(15)
- 资源 (10)
- 收藏
- 关注
原创 APP本地缓存CacheManager
CacheManager(缓存)通过将Bean对象缓存到SD,Bean对象需要序列化实现CacheManager.javapublic class CacheManager<T extends Serializable> { private static String DIR = Environment.getExternalStorageDirectory().getPath();
2016-06-24 10:47:28 1388
原创 DateUtil--日期转换工具
DateUtil–日期转换工具DateUtil.javapublic class DateUtil { private static final long S = 1000L;//一秒 private static final long MIN = 60 * S;//一分钟 private static final long H = 60 * MIN;//一小时 pr
2016-06-23 15:00:04 1099
原创 Android动态设置多语言
动态设置多语言效果图:需求:在设置中添加一个可以设置语言的需求,点击选中的语言,就可以切换显示。demo代码:APP类:app初始化的时候获取保存的语言(没有就系统默认),设置语言。public class APP extends Application { private Object locale; @Override public void onCreate() {
2016-06-22 15:54:22 3564
原创 android5.0之Vector Drawables(矢量图)
android5.0之Vector Drawables(矢量图)效果图:在res/drawable/目录下创建heart.xml,文件内容:<?xml version="1.0" encoding="utf-8"?><vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="256dp"
2016-06-19 22:21:22 1772 2
原创 android5.0之animated-selector
android5.0之animated-selector先看效果图:在res/drawable/目录下创建一个animator_selector.xml文件<?xml version="1.0" encoding="utf-8"?><animated-selector xmlns:android="http://schemas.android.com/apk/res/android"> <
2016-06-19 14:34:03 4911
原创 android5.0StateListAnimator
android5.0StateListAnimator先看效果图StateListAnimator有xml实现和代码实现,和其他属性动画差不多,实现还是比较简单的。1.xml实现(xml文件可以放在drawable目录(不能自动提示),也可以放在animator目录中(建议))<selector xmlns:android="http://schemas.android.com/apk/res/an
2016-06-18 22:01:37 4219
原创 android5.0之Activity过渡动画
android5.0之Activity过渡动画Android5.0提供了3种Transition类型。进入动画:一个进入的过渡动画决定一个Activity中的所有视图怎么进入屏幕。退出动画:一个退出的过渡动画决定一个Activity中的所有视图怎么退出屏幕。共享元素:一个共享元素过渡动画决定2个Activitys之间的过渡,怎么共享他们的视图。其中进入和退出效果有:explode(分解):
2016-06-18 17:53:17 9425
原创 android5 Ripple和Reveal动效
android5 Ripple和Reveal动效Ripple水波纹效果(Button自带)效果图:代码:xml文件<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_w
2016-06-16 18:58:16 1553
原创 44-android5.0 Palette和Clipping
android5.0 Palette和Clipping效果图:案例代码:xml文件<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pare
2016-06-16 15:41:27 562
原创 RecyclerView的Adapter的抽取
RecyclerView的Adapter的抽取最近常用recyclerview控件,每次都需要写一大串代码,于是参考了鸿洋的文章,抽取了一个adapter的基类。具体代码:ContentFragment类public class ContentFragment extends Fragment { private RecyclerView mRecyclerView; private
2016-06-10 16:28:46 2377
原创 状态模式
状态模式定义:当一个对象的内在状态改变时允许改变其行为,这个对象看起来像是改变了其类。使用场景:一个对象的行为取决于它的状态,并且它必须在运行时刻根据状态改变它的行为。一个操作中含有庞大的多分支结构(if..else),并且这些分支决定于对象的状态。类图:模式中的角色:上下文环境(Context):它定义了客户程序需要的接口并维护一个具体状态角色的实例,将与状态相关的操作委托给当前的Conc
2016-06-08 11:18:56 427
原创 原型模式
原型模式定义:Prototype原型模式是一种创建型设计模式,Prototype模式允许一个对象再创建另外一个可定制的对象,根本无需知道任何如何创建的细节,工作原理是:通过将一个原型对象传给那个要发动创建的对象,这个要发动创建的对象通过请求原型对象拷贝它们自己来实施创建。原型模式的优点及适用场景使用原型模式创建对象比直接new一个对象在性能上要好的多,因为Object类的clone方法是一个本地方
2016-06-06 17:54:02 518
原创 使用RxJava和RxAndroid封装RxBus,实现EventBus功能
使用RxJava和RxAndroid封装RxBus,实现EventBus功能依赖第三方库:RxJava和RxAndroidcompile 'io.reactivex:rxjava:1.1.5'compile 'io.reactivex:rxandroid:1.2.0'RxBus的具体代码:public class RxBus { private HashMap<Object, List<S
2016-06-04 21:37:50 6086
原创 建造者模式(生成器模式)
建造者模式定义:将一个复杂对象的构造与它的表示分离,使同样的构建过程可以创建不同的表示,这样的设计模式被称为建造者模式。类图适用范围1 当创建复杂对象的算法应该独立于该对象的组成部分以及它们的装配方式时。2 当构造过程必须允许被构造的对象有不同表示时。角色1 builder:为创建一个产品对象的各个部件指定抽象接口。2 ConcreteBuilder:实现Builder的接口以构造和装配该产品的各个
2016-06-02 15:05:01 674
原创 Error:(1, 0) Plugin is too old, please update to a more recent version报错
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "c9940005c89536c6e958c4c73fd34f3fdcb919e0"
2016-06-01 22:07:37 740
Gradle for Android
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人