Android的web视图处理方向不工作 [英] Android Webview Handling Orientation Not Working

查看:104
本文介绍了Android的web视图处理方向不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用的WebView,我想停下来重新加载页面时方向的变化。

Im using webview and I want to stop reloading the page when orientation changes.

我在我的活动如下:

@Override
public void onConfigurationChanged(Configuration config) {
    super.onConfigurationChanged(config);
}

@Override
protected void onSaveInstanceState(Bundle outState ){
    ((WebView) findViewById(R.id.webView)).saveState(outState);
}

在我的布局,我有:

And in my layout, I have:

<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:configChanges="keyboardHidden|orientation"
android:visibility="gone" >

但上面的code没有工作。即时通讯在Android的2.3.3测试。

But the above code didn't work. Im testing it in Android 2.3.3.

推荐答案

添加的android:configChanges =keyboardHidden |方向,这是使用此布局到您的活动这样你的的Andr​​oidManifest.xml 文件

Add android:configChanges="keyboardHidden|orientation" to your activity which was used by this Layout in your AndroidManifest.xml file like this

<activity
        android:name=".UserProfileActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"/>

用户屏幕大小为新版本的取向可能不会在某些版本需要使用configChanges屏幕尺寸的支持

User screensize for newly version orientation might not be supported in some version need to use screensize for configChanges

这篇关于Android的web视图处理方向不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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