如果在android中我的布局中有两个视频视图,如何使特定的视频视图在横向视图中全屏显示
我的XML中有两个视频视图,并且始终仅在横向模式下显示第一个视频视图,同时更改第二个视频视图的方向 提前谢谢 以下是我的方向更改编码:如果在android中我的布局中有两个视频视图,如何使特定的视频视图在横向视图中全屏显示,android,android-videoview,Android,Android Videoview,我的XML中有两个视频视图,并且始终仅在横向模式下显示第一个视频视图,同时更改第二个视频视图的方向 提前谢谢 以下是我的方向更改编码: @Override public void onConfigurationChanged(Configuration aNewConfig) { super.onConfigurationChanged(aNewConfig); if (aNewConfig.orientation == Configuration.
@Override
public void onConfigurationChanged(Configuration aNewConfig) {
super.onConfigurationChanged(aNewConfig);
if (aNewConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
myOrientationButton.setChecked(aNewConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
aPortraitHeight = myVideoView.getHeight();
aPortraitWidth = myVideoView.getWidth();
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT);
DisplayMetrics myDisplayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(myDisplayMetrics);
int aHeight = myDisplayMetrics.heightPixels;
int aWidth = myDisplayMetrics.widthPixels;
params.height = aHeight;
params.width = aWidth;
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
myView.setLayoutParams(params);
} else if (aNewConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(myVideoView.getLayoutParams());
params.height = aPortraitHeight;
params.width = aPortraitWidth;
myView.setLayoutParams(params);
}
}