- 博客(19)
- 收藏
- 关注
转载 Dagger——Android的依赖注入框架
Dagger-快速依赖注入器这个框架它的好处是它没有采用反射技术(Spring是用反射的),而是用预编译技术,因为基于反射的DI非常地耗用资源(空间,时间)。这里记录一下上面文章的一些关键的要点声明依赖关系Dagger 构造应用程序的类对象,并组合其依赖关系。 Dagger使用 javax.inject.Inject annotation 标记那些需要依赖注入的构造
2015-02-22 21:50:51
617
转载 使用Event Bus模式解耦Android App组件间通信
当应用功能越来越多的时候,我们可以使用Event Bus模式来优雅地实现组件间通信的解耦下面是关于Event Bus的介绍,以及两个Event Bus模式的类库EventBus和Otto1, Event Bus模式介绍2,EventBus使用介绍3,Otto使用介绍
2015-02-14 16:20:01
417
原创 Android优化程序性能的小技巧
1,不要在嵌套的布局文件中设置多余的Background,因为系统绘制布局需要消耗一定的性能2,当一些需要不停变化状态的View不出现在当前屏幕不可见的时候,就让它停止变化,比如一些图片的轮播,当它不可见的时候,就停止轮播3,尽量减少布局的嵌套,因为布局的嵌套层级越深,布局渲染的时间就越久,复杂的布局尽量考虑使用RelativeLayout相对布局来减少嵌套,简单的布局就尽
2015-02-05 16:43:13
669
原创 Android 尺寸单位 屏幕适配
ppi (pixels per inch):图像分辨率 (在图像中,每英寸所包含的像素数目)dp:Density-independent pixels,以160PPI屏幕为标准,则1dp=1px,dp和px的换算公式 :dp*ppi/160 = px。比如1dp x 320ppi/160 = 2px。sp:Scale-independent pixels,它
2015-01-09 16:22:12
851
原创 用Palette提取图片颜色
// 用来提取颜色的BitmapBitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.image);// Palette的部分Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {@Overridepublic v
2014-12-29 21:36:22
498
原创 获取Android资源
private void getUpIndecator(){ //hack from com.android.internal.widget.ActionBarView int id_hamburger=getResources().getIdentifier("up", "id", "android"); int id_title=getResources().getIdentifi
2014-10-13 16:46:00
452
原创 用RadioGroup实现底栏Tab
主界面的布局<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >
2014-09-12 16:34:13
635
原创 实现Dialog风格的Activity
@anim/pop_bottom_in @anim/pop_bottom_out @style/AnimBottom @null true true true @android:colo
2014-09-12 14:27:54
444
原创 Android Tween Animation
旋转动画RotateAnimation rotat=new RotateAnimation(0, 180,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);rotat.setDuration(400);rotat.setFillAfter(true);mCollapse.startAnimation(ro
2014-08-22 09:59:45
443
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人