WebView Orientation change issue

后端 未结 4 673
小鲜肉
小鲜肉 2021-01-20 11:12

I have a layout below where i have a linear layout with gravity as center to make the child center aligned.I want to add a webview programatically and loading the youtube vi

4条回答
  •  失恋的感觉
    2021-01-20 11:44

    If you load video in WebView, so aligment in the WebView is html task. Wrap your video in the

    and add appropriate style (in the css file or as style attribute in the tag):

    //your video object is placed here

    As well you can play a video in the VideoView but this is technique will be a little more difficult. Briefly, you have to add a FrameLayout above the WebView, get the coords where the VideoView should be placed through the the html file and apply LayoutParams with coords for VideoView. If orientation will be changed, VideoView should be refreshed with the new coords. If you interested in this, i can share more details.

提交回复
热议问题