山岭巨人

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年4月22日

摘要: 这份源码是基于2.1的launcher2,以后版本虽有变化,但大概的原理一直还是保留了。一、主要文件和类1.Launcher.java:launcher中主要的activity。2.DragLayer.java:launcher layout的rootview。DragLayer实际上也是一个抽象的界面,用来处理拖动和对事件进行初步处理然后按情况分发下去,角色是一个controller。它首先用onInterceptTouchEvent(MotionEvent)来拦截所有的touch事件,如果是长按item拖动的话不把事件传下去,直接交由onTouchEvent()处理,这样就可以实现item 阅读全文
posted @ 2011-04-22 15:44 山岭巨人 阅读(42627) 评论(3) 推荐(7) 编辑

摘要: 在appWidget中,ImageButton和Button都是被支持的控件,其事件可分成三种类型:一、开启Activity二、开始Service三、发送按钮Action下面开始一个一个分析,如何实现。一、开启Activity1、首先先定义个开启Activity的intenteg:Intent fullIntent=new Intent(this ,FullScreen.class);若要传递数据,则使用intent.putExtra()方法eg:fullIntent.putExtra("isCircle", isCircle);2、用intent实例化一个PendingI 阅读全文
posted @ 2011-04-22 13:16 山岭巨人 阅读(6362) 评论(1) 推荐(2) 编辑

摘要: 1.RemoteView概述到目前为止,我发现RemoteView会用在两个地方:一个是在AppWidget,另外一个是在Notification.先从官方对他的定义来看:RemoteView--A class that describes a view hierarchy that can be displayed in another process. The hierarchy is inflated from a layout resource file, and this class provides some basic operations for modifying the c 阅读全文
posted @ 2011-04-22 12:42 山岭巨人 阅读(24846) 评论(7) 推荐(1) 编辑