Android: Why can't I give an onClickListener to a VideoView?

前端 未结 11 2126
独厮守ぢ
独厮守ぢ 2021-02-03 17:08

I have written these lines of code:

 mVideoView = (VideoView) findViewById(R.id.video_view);
    mVideoView.setOnClickListener(new OnClickListener() {
        @O         


        
11条回答
  •  梦谈多话
    2021-02-03 17:27

    I realize this is an old question but thought I'd chime in with an easy workaround. I can't answer why this doesn't work - seems like a big oversight in my opinion. But an easy workaround is to place your VideoView as the sole View inside a FrameLayout, and set an OnClickListener on the layout. Not ideal, but it works.

提交回复
热议问题