Bigfish QQ760851985 专业MTK 6513 6573 6515 6575软硬件研发、定制
一、基本介绍
什么是Launcher?
状态栏、墙纸不属于Launcher。状态栏的左边是应用图标,右边是系统服务图标
getSystemService(NOTIFICATION_SERVICE)
墙纸是Launcher上的一个普通应用程序
我们能在Launcher上做什么?
添加项目到主屏幕:1.在待机空白处长按2.点击MENU键然后选择“添加”选项菜单
可以选择四类:快捷方式、窗口小部件、文件夹、壁纸
我们还可以在Launcher上拖放、删除、重命名文件夹?、长按项目使它回到home screen?
二、Launcher上的Views
Launcher组件
Launcher Activity(boot开机完成后第一个activity显示给用户、连接workspace/所有应用程
序、在Launcher上处理管理项目、通过Launcher layout定制Views)
Launcher layout概述
DragLayer:FrameLayout,Workspace:ViewGroup,CellLayout:ViewGroup,
BubbleTextView:TextView
底部层布局:导航:导航当前屏幕;热设:拨号和浏览器;所有应用程序入口:手柄view
工作区:位于壁纸上的一块宽阔区域,控制有限数量的屏幕(5个),继承Drag接口
它管理views(CellLayout)、壁纸、屏幕上的内容(快捷方式、窗口小布局、文件夹)
Launcher的Views:CellLayout(继承ViewGroup,负责屏幕上的views,帮助drag&drop)
Drag相关方法:onDragChild、onDragOverChild、onDragAborted、onDropChild
AllAppsViews:一个接口,通过两种实现(AllApps2D、AllApps3D_11/AllApps3D_20)
三、Launcher上的内容
应用、快捷方式、UserFolder、LiveFolder、窗口小控件、搜索小控件
ItemInfo:ApplicationInfo、ShortcutInfo、FolderInfo(UserFolderInfo、LiveFolderInfo)、
LauncherAppWidgetInfo
四、定制
Launcher定制点:
屏幕的默认数量:res/layout-port/-land/launcher.xml(
)
默认工作区项:res/xml/default_workspace.xml
排列所有应用:res/xml/default_toppackage.xml
热设的数量和名字:res/layout-port/-land/launcher.xml,res/values/arrays.xml
定制应用在主菜单中置顶(第一排的四个):default_toppackage.xml
属性:toppackages:所有需要置顶apps的外围标签
App:某一app置顶位置标签
Launcher:topPackageName:app的包名。对应AndroidManifest.xml中,
标签中
的package属性值
Launcher:topClassName:app主类名.对应AndroidManifest.xml中,标签中的
android:name属性值,activity必须包含
Launcher:topOrder:指定app在App List中的位置
处理流程:1.从app对应的AndroidManifest.xml中获取package name及class name
2.在default_toppackage.xml中添加app,并设置app在屏幕中的位置topOrder
3.编译Android
Bigfish QQ760851985 专业MTK 6513 6573 6515 6575软硬件研发、定制
默认墙纸位置:/alps/framework/base/core/res/res/drawable/default_wallpaper.jpg
默认锁屏墙纸位置:
/alps/mediatek/source/framework/banyan/res/res/drawable/lockscreen_default_wallpaper.
jpg
修改/packages/apps/Launcher2/res/values/arrays.xml文件替换Launcher左右导航按钮值