How can I get an Android MediaController to appear from layout xml?

前端 未结 7 1762
无人及你
无人及你 2020-12-28 11:10

I\'ve created a layout.xml file with the following XML, but I can\'t get the MediaController to appear at all.



        
7条回答
  •  一向
    一向 (楼主)
    2020-12-28 11:58

    From this sample project:

    ctlr=new MediaController(this);
    ctlr.setMediaPlayer(video);
    video.setMediaController(ctlr);
    

    Then, it will appear when you tap the screen towards the bottom edge of your VideoView.

    In terms of keeping it on screen all the time...I don't know if that's possible. You can always create your own controller -- here's a sample project that creates its own pop-up translucent controller. It's really not all that hard, and you get full control over everything, including arranging for it to be on-screen all the time.

提交回复
热议问题