您的位置:首页 > 移动开发 > Android开发

Android4.0.3 Launcher应用程序图标放置区域修改

2014-01-07 15:11 369 查看
最开始不知道中间那块区域叫什么,只知道Lancher中间那块操作的地方叫做workspace 上网查了后 发现滑动的时候是CellLayout在进行切换,android4.0默认的CellLayout的区域如图:



基本上已经把整个workspace全占了,同时有的应用程序安装运行后会自动生成桌面快捷方式,而且是生成在桌面左上角,如果不对CellLayout进行修改,生成的桌面快捷方式很可能只有一半会显示出来,所以我就需要对CellLayout的属性进行修改,找了好久终于找到的修改的地方,修改后的效果如图:



这样看起来是不是美观多了。

具体修改如下:

packages/apps/Launcher2/res/layout-sw600dp/workspace.xml内容如下:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0 
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- The workspace contains 5 screens of cells -->

<com.android.launcher2.Workspace
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
    android:paddingTop="@dimen/workspace_content_large_only_top_margin"
    launcher:defaultScreen="2"
    launcher:cellCountX="7"
    launcher:cellCountY="5"
    launcher:pageSpacing="@dimen/workspace_page_spacing">
      <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" />
</com.android.launcher2.Workspace>
增加了以下两句

launcher:cellCountX="7"
    launcher:cellCountY="5"
即限定了x,y轴所存放的应用程序图标的个数

默认情况下是在这个目录,有的产家会根据自己的情况进行设置,那个时候就去device目录下去找了

============================================

作者:hclydao

http://blog.csdn.net/hclydao

版权没有,但是转载请保留此段声明

============================================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: