Android:尝试全屏时WebView会抛出异常

时间:2015-04-09 15:58:58

标签: java android webview

我尝试制作一个Webview,它适用于android:theme="@style/Theme.AppCompat"但当我尝试使用android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"android:theme="@android:style/Theme.NoTitleBar.Fullscreen"android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

全屏时

它抛出异常。

这是例外

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testing.view.webview/com.testing.view.webview.PinchoPancho}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

它告诉我使用/添加Theme.AppCompat,但如果我使用它,它没有全屏显示选项。

其他所有内容都是默认代码,所以我不会发布它。我怎样才能使用Theme.AppCompat全屏?

2 个答案:

答案 0 :(得分:0)

尝试使用此主题

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

答案 1 :(得分:0)

使用沉浸式全屏模式

如何使用:https://developer.android.com/training/system-ui/immersive.htm