简体   繁体   English

Android WebView在方向更改时保留状态

[英]android webview preserve state on orientation change

i have called webview in android now i want to preserve state when orientation changes , i had called android:configChanges for activity still not working see below 我现在已经在android中调用了webview,我想在方向改变时保留状态,我已经为活动调用了android:configChanges仍然无法正常工作,请参见下文

    <activity 
        android:name=".MainActivity"
        android:configChanges="orientation|keyboardHidden|keyboard"/>

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

what have i to do to make it work 我该怎么做才能使其正常工作

Try This, It works very fine for me. 试试这个,对我来说很好。 Add "screenSize" in configChanges 在configChanges中添加“ screenSize”

android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges =“ orientation | keyboardHidden | screenSize”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM