Android的ListView控件运行在项目活动长按发行控件、项目、Android、ListView

2023-09-05 08:47:04 作者:毁我又如何

我使用的是OnItemClickListener,并在ListView的OnItemLongClickListener,现在我在寻找一种方法来检测OnItemLongClick后释放动作,什么是实现这一目标的最佳方式是什么?

I'm using an OnItemClickListener and an OnItemLongClickListener in a ListView, now i'm searching a way to detect the release action after the OnItemLongClick, what's the best way to accomplish this?

推荐答案

看看的这里()(主要是此处,你应该寻找 ACTION_UP ):

Take a look here () (mainly here, you should be looking for ACTION_UP):

公共静态最终诠释ACTION_UP

加在API级别1的getAction()值:​​密钥已经发布了

Added in API level 1 getAction() value: the key has been released.

常量值:1(00000001)

Constant Value: 1 (0x00000001)

是这样的:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
    if (keyCode == KeyEvent.ACTION_UP) {
        // do something on ACTION_UP.
        return true;
    }

    return super.onKeyDown(keyCode, event);
}
 
精彩推荐
图片推荐