我在播放视频(在 VideoView
)的肖像模式(不是全屏幕),当我切换到
I'm playing video (on VideoView
) on portrait mode (not on full screen) and when I change to
横向模式的视频站。
当我将其更改为景观的视频将出现在全屏幕上,并会继续打球。
When I change it to landscape that video will appear on full screen and will keep playing.
任何建议?
推荐答案
所有你需要做的是添加到活动中的AndroidManifest.xml:
all you need to do is add this to activity in AndroidManifest.xml:
android:configChanges="orientation"
您的视频活动应该是这个样子。
Your Video activity should look something like this.
<activity android:name=".VideoPlayerActivity"
android:configChanges="orientation" />
如果你的目标API级别13或更高,则必须包含除定位
值屏幕尺寸
价值如here.您的视频活动应该是这个样子。
If your target API level 13 or higher, you must include the screenSize
value in addition to the orientation
value as described here. Your Video activity should look something like this.
<activity android:name=".VideoPlayerActivity"
android:configChanges="orientation|screenSize" />
,然后添加下面的方法VideoPlayerActivity:
And then add the following method to VideoPlayerActivity:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
相关推荐
最新文章