* 如果configchanges =「方向」 - 不指定, * android系統的處理變化和重新佈局,所以剛開始從創建的佈局和視頻負載。
if android:configchanges =「orientation」, - 這告訴系統該活動將通過它自己處理方向更改。 所以,Android系統不會刷新加載佈局。所以視頻繼續播放。父佈局的寬度不會改變。因此縱向模式下的寬度用於橫向。所以,你的webview似乎很小。
您需要重寫活動中的onconfigurationchanged()並處理方向更改。 您需要指定版面佈局的佈局。
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
// for example the width of a layout
int width = 300;
int height = LayoutParams.WRAP_CONTENT;
WebView childLayout = (WebView) findViewById(R.id.webview);
childLayout.setLayoutParams(new LayoutParams(width, height));
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
}
感謝您的回覆我會讓你知道它是否工作 – user2041902 2013-05-08 06:04:08
新的LayoutParams(寬度,高度)不適用於小於11的api級別。所以我嘗試LinearLayout.LayoutParams(寬度,高度)的web視圖以及佈局我已經放置了webView,但問題仍然存在 – user2041902 2013-05-09 06:06:11
@sowmia如果因爲不能發表評論而無法溝通,請發送郵件到我的gmail ID [email protected] – pvn 2013-05-09 06:51:39