Android Laucnher3 拖拽应用图标阴影投放位置
2017-07-28 16:49
260 查看
要想实现拖拽拖到到任何地方,阴影都投放在Workspace中,只需修改Workspace方法中的onDragOver方法,该方法在拖拽中会不断调用。
通过下面的代码可以看到,当判断用户拖拽图标到hostseat位置中,我们把图标阴影投放在workspace上。
//确定我们是否拖过了侧页 if (workspaceInModalState()) { if (mLauncher.getHotseat() != null && !isExternalDragWidget(d)) { if (isPointInSelfOverHotseat(d.x, d.y, r)) { layout = mLauncher.getHotseat().getLayout(); } } if (layout == null) { layout = findMatchingPageForDragOver(d.dragView, d.x, d.y, false); } if (layout != mDragTargetLayout) { setCurrentDropLayout(layout); setCurrentDragOverlappingLayout(layout); boolean isInSpringLoadedMode = (mState == State.SPRING_LOADED); if (isInSpringLoadedMode) { if (mLauncher.isHotseatLayout(layout)) { mSpringLoadedDragController.cancel(); } else { mSpringLoadedDragController.setAlarm(mDragTargetLayout); } } } } else { // Test to see if we are over the hotseat otherwise just use the current page //测试我们是否在hotseat否则只使用当前页 /** * 修改这里,如果用户把图标拉到hotseat区域也把图标投放到workspace */ if (mLauncher.getHotseat() != null && !isDragWidget(d)) { if (isPointInSelfOverHotseat(d.x, d.y, r)) { // layout = mLauncher.getHotseat().getLayout(); layout = getCurrentDropLayout(); } } if (layout == null) { layout = getCurrentDropLayout(); } if (layout != mDragTargetLayout) { setCurrentDropLayout(layout); setCurrentDragOverlappingLayout(layout); } }
相关文章推荐
- Launcher中批量应用图标拖拽的实现方法
- Android应用中实现拖拽排序及添加阴影的方式
- 关闭ipad和iphone应用图标自动添加阴影和反光等视觉效果
- Android Launcher3修改行数,列数,布局等;隐藏HostSeat,使用户无法拖拽应用图标到Hotseat
- Launcher3禁止用户拖拽应用图标创建文件夹
- Android Launcher3安装应用后,控制应用图标显示位置(显示在第一页上,默认是第二页)
- Android Launcher3安装应用后,控制应用图标显示位置
- Andorid Tv 开发 基础以及 应用安装上打不开,没图标以及遥控器选择的问题
- 为什么Android应用装到了手机上,但是没有图标,之前有图标但是打不开,也不知道为啥
- 如何设计优秀的应用图标?苹果教你这六招
- 去掉桌面图标阴影
- Javascript 拖拽的一些简单的应用(逐行分析代码,让你轻松了拖拽的原理)
- android应用安装位置确定
- android studio设置应用图标时注意事项
- unity3D NGUI 基于UIDraggablePanel实现滑动窗体,带位置图标
- Android APP安装后不在桌面显示图标的应用场景举例和实现方法
- GDI+ 在Delphi程序的应用 -- 可调节的文字阴影特效
- android 图标和图片位置,drawable or mipmap?
- 在 Xcode 5 下让你的应用在不同状态(debug, release)有不同的图标
- Launcher2主菜单应用图标显示于整体布局中之说明