[英]Android Webview Handling Orientation Not Working
我使用webview,我想在方向改變時停止重新加載頁面。
我的活動中有以下內容:
@Override
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
}
@Override
protected void onSaveInstanceState(Bundle outState ){
((WebView) findViewById(R.id.webView)).saveState(outState);
}
在我的布局中,我有:
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:configChanges="keyboardHidden|orientation"
android:visibility="gone" >
但上面的代碼不起作用。 我在Android 2.3.3中測試它。
將android:configChanges="keyboardHidden|orientation"
到您的AndroidManifest.xml
文件中此布局使用的活動中,如下所示
<activity
android:name=".UserProfileActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
某些版本可能不支持用戶篩選新版本方向,需要使用screenize for configChanges
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.