0

我正在使用 VideoPlayerView 并以全屏模式播放视频并添加 OnTouchListener。VideoPlayerView 上的 OnTouchListener 在 android 版本 2.3 中调用,而不是在 android 版本 4.0 中第一次甚至第二次尝试调用。请帮助可能导致在 android 4.0 版中不调用 OnTouchListener 的问题

请帮助我。

提前致谢。

代码:

gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
    currentTime = System.currentTimeMillis();
    if(currentTime - lastTimeExecution > 2 * 1000) {
        lastTimeExecution = currentTime;
        Display display = getWindowManager().getDefaultDisplay();
        int viewWidth = display.getWidth();

        // RIGHT SIDE SCREEN
        if(event.getX()> (viewWidth*0.7)){
            nextVideo(1);
        }
        else if(event.getX()< (viewWidth*0.3)){
            previousVideo(1);
        }
    }
    return true;
}
};

playerView.setOnTouchListener(gestureListener);
4

1 回答 1

0
    1.Get resolution of screen 
    2.Set Height & Width of a panel to screen size.
    3.Set video handle to that panel handle
    4.Listen touch event from that panel
于 2013-06-14T18:06:11.617 回答