Android 在直播时旋转视频视图
我有一个视频视图,在potrait模式下可以很好地播放流媒体链接,视频视图下面列出了一些频道。 我的问题是,我想将我的视频视图旋转到横向模式(全屏,不显示底部的频道列表),而不需要再次缓冲或加载流Android 在直播时旋转视频视图,android,android-videoview,live-streaming,Android,Android Videoview,Live Streaming,我有一个视频视图,在potrait模式下可以很好地播放流媒体链接,视频视图下面列出了一些频道。 我的问题是,我想将我的视频视图旋转到横向模式(全屏,不显示底部的频道列表),而不需要再次缓冲或加载流 谢谢。将android:configChanges=“orientation”添加到AndroidManifest.xml上的活动标记中 它将在旋转时停止对onCreate()的调用,并防止视频中断 并在活动中使用以下代码 //this is called when the screen rotate
谢谢。将android:configChanges=“orientation”添加到AndroidManifest.xml上的活动标记中 它将在旋转时停止对onCreate()的调用,并防止视频中断 并在活动中使用以下代码
//this is called when the screen rotates.
// (onCreate is no longer called when screen rotates due to manifest, see: android:configChanges)
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
int orientation = newConfig.orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT)
{
Log.d("tag", "Portrait");//Do your layout changes here
}
else if (orientation == Configuration.ORIENTATION_LANDSCAPE)
{
Log.d("tag", "Landscape");//Do your layout changes here
}
}
如果它对你有用,就标记为up 我试过了,但它在播放器底部显示了“频道列表”,我希望我的视频视图全屏显示。您可以将频道列表的可见性设置为View.GONE或View.VISIBLE,根据您的需要在旋转更改时显示。这就是方法,你要做的唯一一件事就是按照你的要求轮流管理你的布局。我也尝试过这种方法,没有为我锻炼,因为videoview不会进入“全屏”。试试我的另一个答案。