* 如果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