1.概述
在12.0定制化开发手机项目中,如果专门适配老年机的时候,这时客户提出要求,如果最后一屏未满时,不让拖拽到后面一屏的空屏中这样就需要获取当前是哪一屏,并且要知道当前有多少个Item,总共一屏最多多少个item
所以就需要从Workspace.java入手,来分析解决这个问题文章来源:https://www.toymoban.com/news/detail-461281.html
2.Launcher3长按拖拽时,获取当前是哪一屏,获取当前多少个应用图标的核心类
packages/apps/Launcher3/src/com/android/launcher3/Workspace.java
packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java
3.Launcher3长按拖拽时,获取当前是哪一屏,获取当前多少个应用图标的核心功能实现和分析
首选来看Workspace.java源码 开始拖拽时会调用startDrag()
和beginDragShared(View child, DragSource source, DragOptions options) 等
相关方法文章来源地址https://www.toymoban.com/news/detail-461281.html
public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) {
View child = cellInfo.cell;
mDragInfo = cellInfo;
child.setVisibility(INVISIBLE);
if (options.isAccessibleDrag) {
mDragController.addDragListener(new AccessibleDragListenerAdapter(
this, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG) {
@Overr
到了这里,关于android 12.0Launcher3长按拖拽时,获取当前是哪一屏,获取当前多少个应用图标的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!