没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
从今天起傻蛋打算做一个系列文章,对最新的 系统中的 ,也就是 原生的桌面程序,进行一个
深入浅出的分析,从而引领 系统的编程爱好者对/ 的设计思想,实现方式来做一个研究,从而能够通过这个实例最掌
握到目前世界领先的设计方法,同时在程序中加入我们的一些新的实现。众所周知,对一些优秀源代码的分析,是提高编程水平的一条
便捷的方式,希望本系列文章能够给大家带来一定的启发,同时欢迎大家和作者一起讨论,作者的微博是:
先从整体上对 布局作一个分析,让我们通过查看 和使用 布局查看工具两者结合的方法来对
的整体结构有个了解。通过 来对整个桌面做个截图,如下:
放大后如下所示:/可以看到整个桌面包含的元素,最上面是 的搜索框,下面是一个始终插件,然后是图标,再有就是一个分隔
线,最后是 。请注意,桌面程序其实并不包含桌面壁纸,桌面壁纸其实是由/ !" 来提供,整个桌面其实
是叠加在整个桌面壁纸上的另外一个层。
整个 布局文件如下:
1. <com.android.launcher2.DragLayer
2. xmlns:android="http://schemas.android.com/apk/res/android"
3. xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
4.
5. android:id="@+id/drag_layer"
6. android:layout_width="match_parent"
7. android:layout_height="match_parent">
8.
9. <!--Keepthesebehindtheworkspacesothattheyarenotvisiblewhen
10. wegointoAllApps-->
11. <include
12. android:id="@+id/dock_divider"
13. layout="@layout/workspace_divider"
14. android:layout_width="match_parent"
15. android:layout_height="wrap_content"
16. android:layout_marginBottom="@dimen/button_bar_height"
17. android:layout_gravity="bottom"/>
18. <include
19. android:id="@+id/paged_view_indicator"
20. layout="@layout/scroll_indicator"
21. android:layout_width="wrap_content"
22. android:layout_height="wrap_content"
23. android:layout_gravity="bottom"
24. android:layout_marginBottom="@dimen/button_bar_height"/>
25.
26. <!--Theworkspacecontains5screensofcells-->
27. <com.android.launcher2.Workspace
28. android:id="@+id/workspace"
29. android:layout_width="match_parent"
30. android:layout_height="match_parent"
31. android:paddingTop="@dimen/qsb_bar_height_inset"
32. android:paddingBottom="@dimen/button_bar_height"
33. launcher:defaultScreen="2"
34. launcher:cellCountX="4"
35. launcher:cellCountY="4"
36. launcher:pageSpacing="@dimen/workspace_page_spacing"
37. launcher:scrollIndicatorPaddingLeft="@dimen/workspace_divider_padding_left"
38. launcher:scrollIndicatorPaddingRight="@dimen/workspace_divider_padding_right">
39.
40. <includeandroid:id="@+id/cell1"layout="@layout/workspace_screen"/>
41. <includeandroid:id="@+id/cell2"layout="@layout/workspace_screen"/>
42. <includeandroid:id="@+id/cell3"layout="@layout/workspace_screen"/>
43. <includeandroid:id="@+id/cell4"layout="@layout/workspace_screen"/>
44. <includeandroid:id="@+id/cell5"layout="@layout/workspace_screen"/>
45. </com.android.launcher2.Workspace>
46.
47. <includelayout="@layout/hotseat"
48. android:id="@+id/hotseat"
49. android:layout_width="match_parent"
50. android:layout_height="@dimen/button_bar_height_plus_padding"
51. android:layout_gravity="bottom"/>
52.
53. <include
54. android:id="@+id/qsb_bar"
55. layout="@layout/qsb_bar"/>
56.
57. <includelayout="@layout/apps_customize_pane"
58. android:id="@+id/apps_customize_pane"
59. android:layout_width="match_parent"
60. android:layout_height="match_parent"
61. android:visibility="invisible"/>
62.
63. <includelayout="@layout/workspace_cling"
64. android:id="@+id/workspace_cling"
65. android:layout_width="match_parent"
66. android:layout_height="match_parent"
67. android:visibility="gone"/>
68.
69. <includelayout="@layout/folder_cling"
70. android:id="@+id/folder_cling"
71. android:layout_width="match_parent"
72. android:layout_height="match_parent"
73. android:visibility="gone"/>
74. </com.android.launcher2.DragLayer>
整个布局的根是 #,# 继承了 $,所以 # 本身可以看作是一个 $。
下面是/%,它通过 关键字包含了另外一个布局文件 &%,而这个 &%
包含了一 '(,其实 % 就是 区域上面的那条直线。//再下面是 %%,同样它包含了
&%,其中包含了一个 '(,显示的是一个) 的 文件。实际上就是当 滚动翻页的时候,那个
淡蓝色的页面指示条。//然后桌面的核心容器 ",如下图所示,当然你看到的只是 & 的一部分,其实是一个
&%&,通过/ 可以看到,整个 & 由 * 个 &%& 组成,每个 &%&
其实就是对应桌面一页。而每个 &%& 包含了一个 +,这是一个自定义控件,继承自 (,所以它算是
一个用来布局的控件,在这里主要用来承载我们每页的桌面图标、 和文件夹。
剩余18页未读,继续阅读
资源评论
- zhangmin12122014-04-09还行,不过用处不大,不过不要积分
- jingzi04192014-07-28不能编译啊
- ut20132014-09-02挺好的 ,可以学习怎么写UI
- Peierfans2018-03-13可以参考。。
- 小刚学编码2014-05-12挺好的 ,可以学习怎么写UI
馨去心离
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- date0425111111111111111111111
- 包含贪心算法的定义及python代码部分实现
- 自动驾驶-状态估计和定位之扩展卡尔曼滤波.pdf
- csdn之x-ca-key,x-ca-nonce,x-ca-signature与x-ca-signature-headers探索
- 基于TM1620数码显示芯片STM32单片机驱动程序软件源代码.zip
- 【tomcat6使用redis配置session共享】
- 包含杨辉三角的说明及java代码实现
- FDN371N-NL-VB一款SOT23封装N-Channel场效应MOS管
- AutomotiveSPICE-V4.0 中文版
- Java实现杨辉三角的生成和打印代码示例.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功