ビューに複数のリスナーを追加しようとしています。OnTouchListenerイベントは発生しますが、長押しイベントは発生しません。理由は何ですか?どうすれば解決できますか?:)
これが私の情報源です:
bookFlipper.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View v){ //not fired
Log.d(tag, "Long press invoked!");
//selectText();
return true;
}
});
bookFlipper.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event){
if(!menuShown && !selectionMode){
bookFlipper.onTouchEvent(event);
}
switch(event.getAction()){
case MotionEvent.ACTION_MOVE:
if(selectionMode){
}
return false;
case MotionEvent.ACTION_DOWN:
lastDownX = event.getX();
lastDownY = event.getX();
touchingBook = true;
break;
case MotionEvent.ACTION_UP:
touchingBook = false;
if(!selectionMode){
float diff = event.getX() / screenWidth;
float diffOld = lastDownX / screenWidth;
if(diff <= 0.33 && diffOld <= 0.33 && !menuShown){ // left
prevPage();
}else if(diff >= 0.66 && diffOld >= 0.66 && !menuShown){// right
nextPage();
}else if(diff < 0.66 && diff > 0.33 && diffOld < 0.66 && diffOld > 0.33){ // middle
showOverlay(!menuShown);
}
}
break;
default:
break;
}
return false;
}
});
ありがとう :)