webView 旋轉會destroy activity的問題解法(轉)

webView 旋轉會destroy activity的問題解法(轉)

利用webView顯示url後,如果旋轉螢幕,webView的內容就會不見,這是因為旋轉螢幕會將原ACTIVITY destroy 後再重新create,造成部份變數、設定等會消失,參考網路上解法如下:

只要在 AndroidManifest.xml 中的activity 部份加入紅色部份即可。

<activity android:name=".MainActivity" android:configChanges="screenSize|orientation">


原文出處
http://blograycheng.blogspot.tw/2016/01/webview-destroy-activity.html

留言

這個網誌中的熱門文章

jQuery獲取Select選擇的Text和Value(轉)

Android 在Fragment下控制輸入鍵盤

彈跳視窗iframe的運用