Example #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);
                //Still need to do this to ensure when you rotate from Landscape back to Portrait, the values are reset
                videoView.Holder.SetFixedSize(width, height);
                //playButton.Layout (0, height - 150, width, height);
            }
        }
Example #2
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            var msw = MeasureSpec.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly);
            var msh = MeasureSpec.MakeMeasureSpec(b - t, MeasureSpecMode.Exactly);

            view.Measure(msw, msh);
            view.Layout(0, 0, r - l, b - t);
        }
Example #3
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            var msw = MeasureSpec.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly);
            var msh = MeasureSpec.MakeMeasureSpec(b - t, MeasureSpecMode.Exactly);

            view.Measure(msw, msh);
            view.Layout(0, 0, r - l, b - t);

            captureButton.Visibility = ViewStates.Visible;
        }
Example #4
0
            protected override void OnLayout(bool changed, int l, int t, int r, int b)
            {
                if (changed)
                {
                    var activity = (FormsAppCompatActivity)Context;

                    _modal.Layout(new Rectangle(0, 0, activity.FromPixels(r - l), activity.FromPixels(b - t)));
                    _backgroundView.Layout(0, 0, r - l, b - t);
                }

                _renderer.UpdateLayout();
            }
Example #5
0
        public static Bitmap ConvertViewToBitmap(global::Android.Views.View v)
        {
            v.SetLayerType(LayerType.Hardware, null);
            v.DrawingCacheEnabled = true;

            v.Measure(global::Android.Views.View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified),
                      global::Android.Views.View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified));
            v.Layout(0, 0, v.MeasuredWidth, v.MeasuredHeight);

            v.BuildDrawingCache(true);
            Bitmap b = Bitmap.CreateBitmap(v.GetDrawingCache(true));

            v.DrawingCacheEnabled = false; // clear drawing cache
            return(b);
        }
Example #6
0
        void IPlatformLayout.OnLayout(bool changed, int l, int t, int r, int b)
        {
            if (changed)
            {
                LayoutRootPage(Page, r - l, b - t);
            }

            Android.Platform.GetRenderer(Page).UpdateLayout();

            for (var i = 0; i < _renderer.ChildCount; i++)
            {
                global::Android.Views.View child = _renderer.GetChildAt(i);
                if (child is ModalContainer)
                {
                    child.Measure(MeasureSpecFactory.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(t - b, MeasureSpecMode.Exactly));
                    child.Layout(l, t, r, b);
                }
            }
        }
Example #7
0
            protected override void OnLayout(bool changed, int l, int t, int r, int b)
            {
                var activity        = (FormsAppCompatActivity)Context;
                int statusBarHeight = Forms.IsLollipopOrNewer ? activity.GetStatusBarHeight() : 0;

                if (changed)
                {
                    if (_modal is MasterDetailPage)
                    {
                        _modal.Layout(new Rectangle(0, 0, activity.FromPixels(r - l), activity.FromPixels(b - t)));
                    }
                    else
                    {
                        _modal.Layout(new Rectangle(0, activity.FromPixels(statusBarHeight), activity.FromPixels(r - l), activity.FromPixels(b - t - statusBarHeight)));
                    }

                    _backgroundView.Layout(0, statusBarHeight, r - l, b - t);
                }

                _renderer.UpdateLayout();
            }