Launcher图标排列方式改成4*5时候,旋转时的图标排列
2011-01-13 10:18
405 查看
旋转后图标从0*0开始重新排列:
int layoutcount = mWorkspace.getChildCount(); for (int i=0; i < layoutcount; i++) { CellLayout layout = (CellLayout)mWorkspace.getChildAt(i); boolean[][] occupied = layout.getOccupiedCell(); boolean[][] tmpoccupied = new boolean[5][5]; for (int tmpi =0; tmpi < 4; tmpi++) for (int tmpj = 0; tmpj < 4; tmpj++) { tmpoccupied[tmpi][tmpj] = occupied[tmpi][tmpj]; } tmpoccupied[0][4] = tmpoccupied[1][4] = tmpoccupied[2][4] = tmpoccupied[3][4] = false; tmpoccupied[4][0] = tmpoccupied[4][1] = tmpoccupied[4][2] = tmpoccupied[4][3] = false; int viewcount = layout.getChildCount(); for (int j=0; j < viewcount; j++) { View cell = layout.getChildAt(j); final ItemInfo info = (ItemInfo) cell.getTag(); if (!(info instanceof LauncherAppWidgetInfo)) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams(); tmpoccupied[lp.cellX][lp.cellY] = false; } } //int viewcount = layout.getChildCount(); for (int j=0; j < viewcount; j++) { View cell = layout.getChildAt(j); final ItemInfo info = (ItemInfo) cell.getTag(); if (!(info instanceof LauncherAppWidgetInfo)) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams(); out: { if (NUMBER_CELLS_X == 5) { for (int tmpi = 0; tmpi < 5; tmpi++) for (int tmpj = 0; tmpj < 4; tmpj++) { if (tmpoccupied[tmpj][tmpi] == false) { //tmpoccupied[lp.cellX][lp.cellY] = false; LauncherModel.moveItemInDatabase(this, info, LauncherSettings.Favorites.CONTAINER_DESKTOP, i, tmpj, tmpi); tmpoccupied[tmpj][tmpi] = true; break out; } } }else if(NUMBER_CELLS_Y == 5) { for (int tmpi = 0; tmpi < 4; tmpi++) for (int tmpj = 0; tmpj < 5; tmpj++) { if (tmpoccupied[tmpj][tmpi] == false) { LauncherModel.moveItemInDatabase(this, info, LauncherSettings.Favorites.CONTAINER_DESKTOP, i, tmpj, tmpi); tmpoccupied[tmpj][tmpi] = true; //tmpoccupied[lp.cellX][lp.cellY] = false; break out; } } } } }
相关文章推荐
- 如何解决win10桌面图标位置和排列方式无法保存问题
- Launcher2 自定义应用快捷方式图标
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- 如何更改所有文件夹的图标排列方式和查看方式
- 如何把资源管理器默认排列方式,设置为按修改日期排列图标的方法?
- 集合的全排列问题-递归实现方式的改进---旋转法
- C#利用GDI+绘制旋转文字,矩形内可以根据布局方式排列文本
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- 设置文件及文件夹的默认图标排列方式
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- Android Launcher-----桌面应用快捷方式的开发!
- mysql实现插入一条记录时候还回主键值,表的主键是自增长方式AUTO_INCREMENT
- 什么时候加上android.intent.category.DEFAULT和LAUNCHER
- Android 轻松打造一个APP动态切换桌面图标Launcher
- Android 添加、移除桌面快捷方式图标
- launcher默认app图标排序xml
- Android之快捷方式二——向Launcher添加快捷方式