2011.06.09——— android 1.6 launcher研究之修改worksapce下的屏数

2011.06.09——— android 1.6 launcher研究之修改worksapce上的屏数2011.06.09——— android 1.6 launcher研究

2011.06.09——— android 1.6 launcher研究之修改worksapce上的屏数
2011.06.09——— android 1.6 launcher研究之修改worksapce上的屏数

参考:http://blog.csdn.net/fzh0803/archive/2011/03/26/6279995.aspx
http://gqdy365.iteye.com/blog/897638
http://www.cnblogs.com/playing/archive/2011/03/26/1996209.html

android1.6的版本有3个屏 需要把它改为5个屏 需要修改的地方 如下

1、Launcher.java



defaultScreen 修改为2 然后 加两个<include />

然后 修改默认显示的屏

3、Workspace.java

修改构造方法里面的


大功告成 over

最后 说一个期间的一个知识
自定义控件的属性 declare-styleable

比如说 我们上面修改的 launcher:defaultScreen="2" 这个就是自定义的属性 因为这属性不是ViewGroup(workspace类是继承于ViewGroup)所定义的属性

1、在\res\values里面的attrs.xml里面定义



2、layout.xml引用

       public Workspace(Context context, AttributeSet attrs, int defStyle) {        super(context, attrs, defStyle);        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0);        mDefaultScreen = a.getInt(R.styleable.Workspace_defaultScreen, 2);        a.recycle();        initWorkspace();    }