背景:
阅读新闻
Android Launcher View构架浅析
[日期:2011-02-16] 来源:csdn 作者:ccwwff [字体:]
1. 先来看一下launcher activity view的架构图(hierarchyviewer.bat工具获取):
2. 再来看layout/launcher.xml, layout-port/launcher.xml, layout-land/launcher.xml
<com.Android.Launcher.DragLayer
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.Launcher"
android:id="@+id/drag_layer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF">
<!-- The workspace contains 3 screens of cells -->
<com.android.Launcher.Workspace
android:id="@+id/workspace"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
launcher:defaultScreen="1">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
<include android:id="@+id/cell3" layout="@layout/workspace_screen" />
</com.android.Launcher.Workspace>
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:bottomOffset="4dip"
android:handle="@+id/all_apps"
android:content="@+id/content">
<com.android.Launcher.HandleView
android:id="@id/all_apps"
android:layout_width="56dip"
android:layout_height="56dip"
android:background="@drawable/handle"
android:focusable="true"
android:clickable="true"
android:scaleType="center"
android:src="@drawable/handle_icon"
launcher:direction="vertical" />
<com.android.Launcher.AllAppsGridView
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
launcher:texture="@drawable/pattern_carbon_fiber_dark"
android:scrollbarStyle="outsideInset"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/grid_selector"
android:nextFocusLeft="@id/all_apps"
android:nextFocusDown="@id/content"
android:nextFocusUp="@id/content"
android:nextFocusRight="@id/content"
android:verticalSpacing="10dip"
android:numColumns="5" />
</SlidingDrawer>
<com.android.Launcher.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="49dip"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/ic_delete"
android:background="@drawable/delete_zone_selector"
android:layout_marginBottom="-25dip"
android:layout_gravity="right|center_vertical"
android:visibility="gone"
launcher:direction="vertical" />
</com.android.Launcher.DragLayer>
3. 呈现界面:()
其中Workspace可增加到任意多个cell,如7个:
launcher:defaultScreen="3">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
<include android:id="@+id/cell3" layout="@layout/workspace_screen" />
<include android:id="@+id/cell4" layout="@layout/workspace_screen" />
<include android:id="@+id/cell5" layout="@layout/workspace_screen" />
<include android:id="@+id/cell6" layout="@layout/workspace_screen" />
<include android:id="@+id/cell7" layout="@layout/workspace_screen" />
相关资讯 Android教程
本文评论 查看全部评论 (2)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
第 2 楼
赵玲慧 发表于 2011/5/28 11:42:14launcher的ui解析 ***/read.php?tid=9724
(0) (0)
第 1 楼
陈明 发表于 2011/4/12 21:19:39顶
(0) (0)
最新资讯