我正在尝试捕获应用程序中的长键键。我尝试了事件跟踪,但似乎没有用。这是我的代码块:
public override bool OnKeyLongPress([GeneratedEnum] Android.Views.Keycode keyCode, KeyEvent e)
{
if (e.KeyCode == Android.Views.Keycode.Num7)
{
return true;
}
return base.OnKeyLongPress(keyCode, e);
}
public override bool OnKeyUp([GeneratedEnum] Android.Views.Keycode keyCode, KeyEvent e)
{
if (e.KeyCode == Android.Views.Keycode.Num7)
{
if (e.IsTracking && e.IsLongPress)
{
}
return true;
}
return base.OnKeyUp(keyCode, e);
}
public override bool OnKeyDown([GeneratedEnum] Android.Views.Keycode keyCode, KeyEvent e)
{
if (e.KeyCode == Android.Views.Keycode.Num7)
{
if (e.IsTracking && e.IsLongPress)
{
}
return true;
}
return base.OnKeyUp(keyCode, e);
}
即使我按住密钥超过3秒钟,我也完全不会收到IsLongpress
为真