onTouchListener not working

前端 未结 3 2346
青春惊慌失措
青春惊慌失措 2021-02-19 04:13

I have the following code in my activity. In my xml, the video view is inside the linear layout. However, when the view is clicked, the onTouchListener never fires.

3条回答
  •  不要未来只要你来
    2021-02-19 04:43

    Modify your code like this and try:

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.d(TAG, "onTouch entered");
        if(event.getAction() == MotionEvent.ACTION_UP) {
            Log.d(TAG, "ACTION_UP");
            return super.onTouchEvent(event);
        else
            return false;
    }
    

提交回复
热议问题