修改Launcher
来源:互联网 发布:高维空间 知乎 编辑:程序博客网 时间:2024/05/17 03:22
1.左滑切换到显示所有apps
PageView.java->onTouchEvent->case MotionEvent.ACTION_UP->if (mTouchState == TOUCH_STATE_SCROLLING)->else { snapToDestination();->后添加
if(((isSignificantMove && deltaX > 0 && !isFling) ||
(isFling && velocityX > 0)) && mCurrentPage == 0)
{
snapToLeftDestination();
}
并在Workspace.java中重写函数
protected void snapToLeftDestination() {
mLauncher.showAllApps(true);
}
2.静态添加屏幕和屏幕上的快捷键
http://blog.csdn.net/the01hierarch/article/details/7641521
android1.6的版本有3个屏 需要把它改为5个屏 需要修改的地方 如下
1、Launcher.java
- static final int SCREEN_COUNT = 5;
- static final int DEFAULT_SCREN = 2;
2、launcher.xml
- <com.lp.launcher.Workspace
- android:id="@+id/workspace"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- launcher:defaultScreen="2">//从0开始
- <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.lp.launcher.Workspace>
defaultScreen 修改为2 然后 加两个<include />
然后 修改默认显示的屏
3、Workspace.java
修改构造方法里面的
- mDefaultScreen = a.getInt(R.styleable.Workspace_defaultScreen, 2);//从0开始
这时 基本上已经可以显示5个屏幕了 默认的屏也是第三个屏了 但是进去后 默认显示的屏什么也没有 我们需要把组建都挪到默认屏上去
4、default_workspace.xml
修改所有的 launcher:screen 为 2
- launcher:screen="2"
3.桌面最下方显示3个指定快捷方式
方法一:在launcher.xml中删除
<include
android:id="@+id/hotseat"
android:layout_width="match_parent"
android:layout_height="@dimen/button_bar_height_plus_padding"
android:layout_gravity="bottom"
layout="@layout/hotseat"/>
并添加相应的按钮
方法二:修改default_workspace.xml
方法三:如果是定死热键,不可改变的话不推荐
重写LauncherModel->loadWorkspace中获得的数据方法,其中sWorkspaceItems.add(info);就是添加快捷方式(包括桌面widget和下面的热键)
在Hotseat->resetLayout->删除mContent.addViewToCellLayout(allAppsButton, -1, 0, new CellLayout.LayoutParams(x,y,1,1), true);
4.动态添加屏幕
在launcher.java中添加两个按键事件---------之后可以将这两个按钮作为appwidget加到默认的桌面上,和launcher交互用动态(内部注册)广播
public void addScreen(View view)
{
LayoutInflater mInflater = LayoutInflater.from(this);
CellLayout mCelllayout =(CellLayout)mInflater.inflate(R.layout.workspace_screen,null);
mWorkspace.addView(mCelllayout);
mWorkspace.requestLayout();
}
public void removeScreen(View view)
{
int currentPage = mWorkspace.getCurrentPage();
int countPage = mWorkspace.getChildCount();
if(countPage > 1)
{
if(currentPage == (countPage - 1))
{
currentPage--;
}
mWorkspace.removeViewAt(countPage - 1);
}
mWorkspace.requestLayout();
mWorkspace.snapToPage(currentPage);
}
- 修改Launcher
- Launcher修改
- launcher修改--launcher架构解析
- launcher修改--launcher架构解析
- launcher修改--launcher架构解析
- launcher修改--launcher架构解析
- launcher修改--修改launcher的屏幕数
- launcher修改--修改launcher的屏幕数
- Android Launcher修改
- Launcher壁纸修改
- launcher修改,启动
- launcher界面修改
- Launcher的修改
- Launcher的修改
- android Launcher修改解析
- android 修改默认Launcher
- Launcher修改--修改底部图标
- Android launcher -- launcher源码修改 1
- 通俗易懂云计算
- 一套鼠标键盘控制两台电脑-绝!
- 获取python执行shell命令的结果
- 算法系列之十六:使用穷举法解猜结果游戏算法系列之十六:使用穷举法解猜结果游戏
- 双链表
- 修改Launcher
- SQL server中的简单触发器
- 数据库镜像实施笔记
- INT3断点
- s3c6410中断处理
- C++文件操作
- Android Root
- 售前工作职责和流程
- MFC消息结构和消息处理