其他分享
首页 > 其他分享> > 如何从Delphi禁用Android主页和后退按钮

如何从Delphi禁用Android主页和后退按钮

作者:互联网

我正在为Delphi XE7中的Android平板电脑编写应用程序.我想关掉主页和后退键,这样就没有人可以离开应用程序了.我找到了很多答案,但都没有提到Delphi.

我怎样才能在Delphi中实现这一目标?我应该使用哪些物品?我需要包括哪些单位?

解决方法:

documentation

Using the Android Device’s Back Button

To make your application handle when users press the Back button on
their Android device, add an event handler to your form for OnKeyUp,
and use the following code within your event handler: In Delphi:

if Key = vkHardwareBack then
begin
  // Do whatever you want to do here
  Key := 0; // Set Key = 0 if you want to prevent the default action
end;

标签:delphi-xe7,android,delphi,back-button
来源: https://codeday.me/bug/20190728/1560134.html