コード例 #1
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            //Calculate width and height for easier reading
            width  = r - l;
            height = b - t;

            //If in Landscape, we want to make sure we are in full screen
            if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape)
            {
                //Landscape Orientation
                view.Layout(0, 0, width, height);
                videoView.Layout(0, 0, width, height);
                //You must also set the size of the videoView holder, or else full screen won't work
                //If the layout of the videoView increases, that doesn't mean the holder that holds the video automaticall increases
                videoView.Holder.SetFixedSize(width, height);
            }
            else
            {
                //Portrait Orientation, just layout everything nomally
                view.Layout(0, 0, width, height);
                videoView.Layout(0, 0, width, height - 150);
                //Still need to do this to ensure when you rotate from Landscape back to Portrait, the values are reset
                videoView.Holder.SetFixedSize(width, height - 150);
                playButton.Layout(0, height - 150, width, height);
            }
        }