我想从corona sdk中的按钮中禁用android screentouched keyevents和systemevents:主页按钮,屏幕截图和最近打开的应用程序,这样它们在应用程序中根本不起作用,并且应用程序永远不会被暂停。
答案 0 :(得分:1)
您无法在任何Android或iOS应用程序中禁用主页按钮。
以下是控制这些关键事件的方法,但我不确定您是否可以禁用它们:
-- Called when a key event has been received.
local function onKeyEvent( event )
-- Print which key was pressed down/up to the log.
local message = "Key '" .. event.keyName .. "' was pressed " .. event.phase
print( message )
-- If the "back" key was pressed on Android, then prevent it from backing out of your app.
if (event.keyName == "back") and (system.getInfo("platformName") == "Android") then
return true
end
-- Return false to indicate that this app is *not* overriding the received key.
-- This lets the operating system execute its default handling of this key.
return false
end
-- Add the key event listener.
Runtime:addEventListener( "key", onKeyEvent );
答案 1 :(得分:0)
除了Ninja Pig Studio所说的,最近打开的应用程序按钮也不能被困。这些由操作系统处理,您的应用程序获得的唯一关键按钮是“后退”按钮和“音量调高/调低”按钮。