Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果在android中我的布局中有两个视频视图,如何使特定的视频视图在横向视图中全屏显示_Android_Android Videoview - Fatal编程技术网

如果在android中我的布局中有两个视频视图,如何使特定的视频视图在横向视图中全屏显示

如果在android中我的布局中有两个视频视图,如何使特定的视频视图在横向视图中全屏显示,android,android-videoview,Android,Android Videoview,我的XML中有两个视频视图,并且始终仅在横向模式下显示第一个视频视图,同时更改第二个视频视图的方向 提前谢谢 以下是我的方向更改编码: @Override public void onConfigurationChanged(Configuration aNewConfig) { super.onConfigurationChanged(aNewConfig); if (aNewConfig.orientation == Configuration.

我的XML中有两个视频视图,并且始终仅在横向模式下显示第一个视频视图,同时更改第二个视频视图的方向

提前谢谢

以下是我的方向更改编码:

@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);
        }
    }