1、添加网络访问权限
<uses-permission android:name="android.permission.INTERNET" />
developer官方文档关于html5支持视频播放描述如下:In order to support inline HTML5 video in your application, you need to have hardware acceleration turned on, and set a WebChromeClient
. For full screen support, implementations of onShowCustomView(View, WebChromeClient.CustomViewCallback)
and onHideCustomView()
are required, getVideoLoadingProgressView()
is optional.
1)开启硬件加速
2)重写WebChromeClient的onShowCustomView(View, WebChromeClient.CustomViewCallback)
和onHideCustomView()
通过onShowcustomView对大屏的布局进行加载,隐藏小屏布局;在onHideCustomeView中退出全屏播放,重新显示小屏布局
参考:
http://developer.android.com/reference/android/webkit/WebView.html