当我从纵向更改为横向时,我的 Web 视图重新加载 [英] My Webview Reloads When I Change From Portrait To Landscape

查看:24
本文介绍了当我从纵向更改为横向时,我的 Web 视图重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 WebView,它在 Android 上运行一个 Web 应用程序.问题是当我旋转手机以将其更改为横向时 webview 重新加载并返回到开头.

I have a simple WebView that runs a web application on an Android. The problem is when I rotate the phone to change it to landscape the webview reloads and goes back to the beginning.

如何阻止此操作?

罗恩

推荐答案

从 Android 3.2(API 级别 13)开始,当设备在纵向和横向之间切换时,屏幕尺寸"也会发生变化.因此,如果在为 API 级别 13 或更高级别(由 minSdkVersion 和 targetSdkVersion 属性声明)开发时要防止由于方向更改而导致运行时重新启动,则除了orientation"值之外,还必须包括screenSize"值.也就是说,你必须 decalare

Beginning with Android 3.2 (API level 13), the "screen size" also changes when the device switches between portrait and landscape orientation. Thus, if you want to prevent runtime restarts due to orientation change when developing for API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), you must include the "screenSize" value in addition to the "orientation" value. That is, you must decalare

<activity android:configChanges="orientation|screenSize">

文档如下:http://developer.android.com/guide/topics/resources/runtime-changes.html

这篇关于当我从纵向更改为横向时,我的 Web 视图重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆