【问题标题】:Enabling fullscreen video in webview在 webview 中启用全屏视频
【发布时间】:2016-08-26 12:52:01
【问题描述】:

我已在我的 web 视图中启用视频支持,但在 youtube 视频中,没有全屏图标。

在清单中:

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

【问题讨论】:

    标签: android video webview fullscreen


    【解决方案1】:

    请点击以下链接;

    Web-view with full you-tube video

    您需要实现 WebChromeClient 的 showCustomView 和 hideCustomView 方法,还需要在您的 AndroidManifest 文件中设置 android:hardwareAccelerated="true"。我在这里发布我的示例项目。我所做的是在我的 main.xml 中保留一个 Framelayout(customContainer),并在此处添加在 showCustomView 中收到的视图,并在 onHide 中将其删除。也相应地隐藏/显示 webview。下面的代码在设备上完美运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-06
      • 1970-01-01
      • 2013-03-24
      • 1970-01-01
      • 2013-08-23
      • 2016-08-25
      相关资源
      最近更新 更多