gpt4 book ai didi

android - 来自 Android 抽屉的 ViewDragHelper 的过多日志

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:24:38 24 4
gpt4 key购买 nike

当我的用户执行某些涉及拖动对象的操作时,我将禁用 Android 抽屉导航。这是为了防止他们不小心打开抽屉。问题是我被日志消息淹没了。这使得解决其他问题变得困难。

这就是我锁抽屉的方式。

drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

这是我收到的日志消息。

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.

最佳答案

我遇到了同样的问题,我使用 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);
}

因此,当我阻止我的 DrawerLayout 时,我不允许触摸事件,并且 Log 不会显示很多错误消息,说明它们丢失了很多事件。

希望对您有所帮助!

关于android - 来自 Android 抽屉的 ViewDragHelper 的过多日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40687745/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com