res/values/attrs.xml
<declare-styleable name="CellLayout"><!-- The width of a single cell --><attr name="cellWidth" format="dimension"></attr><!-- The height of a single cell --><attr name="cellHeight" format="dimension"></attr>
.....
</declare-styleable>
res/layout-port/workspace_screen.xml
<com.android.launcher.celllayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" android:layout_width="fill_parent" android:layout_height="fill_parent" launcher:cellwidth="80dip" launcher:cellheight="96dip" ....></com.android.launcher.celllayout>
src/com.android.launcher.CellLayout.java
public CellLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0);
mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10);
mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10);
.....
}
根据颜色看, 应该很清晰:
1. 蓝色部分是自己定义的styleable和attr的名称, 代码和XML里要一致;
2. 绿色部分是自定义的命名空间名称, 也只要上下保持一致即可;
3. 红色部分是View所在的包名, 不允许有误.
参考:http://blog.csdn.net/Android_Tutor/archive/2010/04/21/5508615.aspx
http://hi.baidu.com/lck0502/blog/item/8d4e453f80cf43cf7c1e714b.html
分享到:
相关推荐
Android Launcher源码下载,PagedView,PagedViewIcon
Android Launcher 源码修改可编译.zip源码资源下载Android Launcher 源码修改可编译.zip源码资源下载
安卓Android源码——Android Launcher 源码修改可编译.zip
Android高级应用源码-Android Launcher 源码修改可编译.zip
android源码的Launcher详细解析,分析Launcher的运行机制
Android系统桌面Launcher3源码,可直接在Android Studio中编译。
Android Launcher 源码修改可编译,作为app开发参考用。
1.适用android 盒子,1920*1080(密度240),1280*720(密度160),1280*720(密度213) 2,eclipse 代码 3,主页功能介绍(第一排,左边语音调起,右边时间,第二排,常用国外视频app,第三排所有apps,第四排设置,...
android 自定义 模仿Launcher 是平板的,手机的,需要调整下分辨和图片大小,有的显示不出来,但代码是成熟的代码
Android-launcher源码全面分析 一 Launcher默认界面配置(default workspace) 2 1 界面默认配置文件 2 2 LauncherProvider java的loadFavorites分析 3 二 Icon修改 界面布局调整 壁纸设置 5 1 图标大小和标题大小 5...
android laucnher3 源码,仅供学习使用。
这个是android Launcher2.2 源码,我最近在学习,有人想跟我交流就到我的博客:http://blog.csdn.net/gqdy365
Android桌面程序Launcher源码.
launcher源码(ADWlauncher+android4.0原生launcher)
android2.3 launcher 源码
安卓Android源码——Launcher源码修改可编译.zip
android Launcher3 源码下载 从4 4 2剥离
安卓Android源码——安卓Android Launcher 桌面分页滑动代码.rar
android 定制 launcher 源码
Androidlauncher开发.pdf