我有一个项目列表,我想当用户按下其中一个项目时,弹出窗口将打开,当他松开时,它将关闭。
我知道如何使用setOnItemClickListener在按键时打开弹出窗口(互联网上无数的例子)。当我重新激活该物品时,如何使其停止?
谢谢。
哑光
发布于 2012-08-23 06:36:59
请考虑改用OnTouchListener(),它捕获向下、向上、移动等的单独事件:
view.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Open popup
break;
case MotionEvent.ACTION_UP:
// Close popup
}
return true;
}
});https://stackoverflow.com/questions/12082273
复制相似问题