gpt4 book ai didi

android - onKeyDown mFlags 变量

转载 作者:太空狗 更新时间:2023-10-29 14:30:50 26 4
gpt4 key购买 nike

我有一个从 onKeyDown 事件返回的日志,标志的结果是数字 520。我如何找出标志是什么?我假设它的 520 = 512 + 8 = FLAG_TRACKING + FLAG_FROM_SYSTEM

我需要确定,我听说它与十六进制代码有关。我如何转换并找出?

来自日志:

onKeyUp - 键码:118 |信息:KeyEvent{action=ACTION_UP code=118 repeat=0 meta=0 scancode=766 mFlags=520}

我需要知道 mFlags 的名称是什么。

谢谢。

最佳答案

完整代码如下:

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | isCanceled: " + event.isCanceled() + " | info: "  + event.toString());

if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) == KeyEvent.FLAG_FROM_SYSTEM)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_FROM_SYSTEM");

}else {}

if ((event.getFlags() & KeyEvent.FLAG_TRACKING) == KeyEvent.FLAG_TRACKING)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_TRACKING");
}else {}



///FLAG_WOKE_HERE
if ((event.getFlags() & KeyEvent.FLAG_WOKE_HERE) == KeyEvent.FLAG_WOKE_HERE)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_WOKE_HERE");
}else {}


//FLAG_SOFT_KEYBOARD
if ((event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_SOFT_KEYBOARD");
}else {}

//FLAG_KEEP_TOUCH_MODE
if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) == KeyEvent.FLAG_KEEP_TOUCH_MODE)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_KEEP_TOUCH_MODE");
}else {}


//FLAG_EDITOR_ACTION
if ((event.getFlags() & KeyEvent.FLAG_EDITOR_ACTION) == KeyEvent.FLAG_EDITOR_ACTION)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_EDITOR_ACTION");
}else {}


//FLAG_CANCELED
if ((event.getFlags() & KeyEvent.FLAG_CANCELED) == KeyEvent.FLAG_CANCELED)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_CANCELED");
}else {}


//FLAG_VIRTUAL_HARD_KEY
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == KeyEvent.FLAG_VIRTUAL_HARD_KEY)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_VIRTUAL_HARD_KEY");
}else {}

//FLAG_LONG_PRESS
if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) == KeyEvent.FLAG_LONG_PRESS)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_LONG_PRESS");
}else {}

//FLAG_CANCELED_LONG_PRESS
if ((event.getFlags() & KeyEvent.FLAG_CANCELED_LONG_PRESS) == KeyEvent.FLAG_CANCELED_LONG_PRESS)
{

Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_CANCELED_LONG_PRESS");
}else {}

关于android - onKeyDown mFlags 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7111851/

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