onTouchListener not working

前端 未结 3 2222
青春惊慌失措
青春惊慌失措 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:53

    i have faces this issue and the solutions is:-

    1-in your xml set the followin attribute to VideoView

    android:clickable="true"

    2- simply in your code set setOnClickListenerto the VideoView and it will work like charm:

    videoView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent=new Intent(CinemaDetailsActivity.this , FullScreenPlayerActivity.class);
            intent.putExtra("url" ,  getIntent().getStringExtra("url"));
            startActivity(intent);
        }
    });
    

提交回复
热议问题