the*_*osh 5 android navigation-drawer
当我的用户执行涉及拖动对象的某些操作时,我正在禁用Android导航抽屉.这是为了防止他们意外打开抽屉.问题是我被日志消息淹没了.这使得很难解决其他问题.
这就是我锁定抽屉的方式.
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
Run Code Online (Sandbox Code Playgroud)
这是我得到的日志消息.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.
Run Code Online (Sandbox Code Playgroud)
小智 7
我有同样的问题,我使用requestDisallowInterceptTouchEvent函数解决了它,如下所示:
public void blockMainMenu(){
((DrawerLayout) findViewById(R.id.drawer_layout)).requestDisallowInterceptTouchEvent(true);
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
}
public void unblockMainMenu(){
((DrawerLayout) findViewById(R.id.drawer_layout)).requestDisallowInterceptTouchEvent(false);
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
Run Code Online (Sandbox Code Playgroud)
所以,当我阻止我的DrawerLayout时,我不允许触摸事件,而Log不会显示很多错误消息,说明它们丢失了很多事件.
希望这可以帮到你!
| 归档时间: |
|
| 查看次数: |
1654 次 |
| 最近记录: |