整个应用程序的长按事件检测

时间:2017-07-17 09:09:15

标签: android onlongclicklistener

添加了系统覆盖类型的叠加层。我想收到onLongPress事件,并让所有其他事件传递给下面的活动。系统叠加已添加,但我无法接收任何事件。

请帮忙。 在此先感谢

1 个答案:

答案 0 :(得分:0)

我建议使用root视图:

getWindow().getDecorView().findViewById(android.R.id.content).setOnLongClickListner(<this or your own listener>)

在您想要的每个Activity中的每个onCreate方法中实现此功能。