Home  >  Q&A  >  body text

java - surfaceview播放视频想实现点击按钮由竖屏转变为横屏实现。。

给下xml图片,

就是想点击了那个change按钮然后整个activity就能横屏显示,视频也将变成横屏播放,不知道该怎么做。。网上看了很多这方面的也没看懂。很多方法也有各种错误,没有实现。想问一下实现思路,应该也不会太难。。

高洛峰高洛峰2743 days ago585

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-18 10:55:46

    I have written a similar function before, and it is implemented like this:

    • The full-screen playback interface is a new activity, and the layout file has only one root layout (such as RelativeLayout)

    • The controller of the video control (for example, the one I customized is called VideoPlayerHelper) is in global singleton mode

    • Click the full-screen button to jump to the full-screen activity. Add VideoPlayerView to the current interface through the root layout addView method of this activity, and display the progress information recorded by VideoPlayerHelper in singleton mode

    reply
    0
  • Cancelreply