Ejemplo n.º 1
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            if (!CustomNavigationPage.GetIsTranslucent(CurrentPage))
            {
                return;
            }

            int containerHeight = b - t;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));

            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                if (child is Android.Support.V7.Widget.Toolbar toolbar)
                {
                    continue;
                }

                child.Layout(0, 0, r, b);
            }
        }
Ejemplo n.º 2
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            CustomNavigationPage.IgnoreLayoutChange = true;
            base.OnLayout(changed, l, t, r, b);
            CustomNavigationPage.IgnoreLayoutChange = false;

            int containerHeight = b - t;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));
            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                if (child is Android.Support.V7.Widget.Toolbar)
                {
                    continue;
                }

                child.Layout(0, 0, r, b);
            }

            if (AndroidHelper.contextActivity != null)
            {
                var that    = (AndroidHelper.contextActivity as Xamarin.Forms.Platform.Android.FormsAppCompatActivity);
                var toolbar = that.FindViewById <Android.Support.V7.Widget.Toolbar>(AndroidHelper.ToolBarId);
                toolbar.SetNavigationOnClickListener(AndroidHelper.OnClickListener);
            }
        }
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            CustomNavigationPage.IgnoreLayoutChange = true;
            base.OnLayout(changed, l, t, r, b);
            CustomNavigationPage.IgnoreLayoutChange = false;

            int containerHeight = b - t;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));

            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                if (child is Android.Support.V7.Widget.Toolbar)
                {
                    continue;
                }

                if (child is TextView)
                {
                }

                child.Layout(0, 0, r, b);
            }
            //base.OnLayout(changed, l, t, r, b);
        }
Ejemplo n.º 4
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            int childCount = ChildCount;
            int allHeight  = 0;

            for (int i = 0; i < childCount; i++)
            {
                View view       = GetChildAt(i);
                int  viewHeight = view.MeasuredHeight;
                view.Layout(l, allHeight, r, allHeight + viewHeight);
                allHeight += viewHeight;
            }
        }
Ejemplo n.º 5
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            if (NativeView != null)
            {
                var msw = MeasureSpec.MakeMeasureSpec(r - l, Android.Views.MeasureSpecMode.Exactly);
                var msh = MeasureSpec.MakeMeasureSpec(b - t, Android.Views.MeasureSpecMode.Exactly);

                NativeView.Measure(msw, msh);
                NativeView.Layout(0, 0, r - l, b - t);
            }
        }
Ejemplo n.º 6
0
        protected void ArrangeChildOverride(View view, Rect frame)
        {
            LogArrange(view, frame);

            var physicalFrame = frame.LogicalToPhysicalPixels();

            view.Layout(
                (int)physicalFrame.Left,
                (int)physicalFrame.Top,
                (int)physicalFrame.Right,
                (int)physicalFrame.Bottom
                );
        }
Ejemplo n.º 7
0
        public static Bitmap AsBitmap(this Android.Views.View view, Context context, int width, int height)
        {
            DisplayMetrics displayMetrics = new DisplayMetrics();

            view.Measure(displayMetrics.WidthPixels, displayMetrics.HeightPixels);
            view.Layout(0, 0, displayMetrics.WidthPixels, displayMetrics.HeightPixels);

            view.BuildDrawingCache();
            Bitmap bitmap = Bitmap.CreateBitmap(displayMetrics, width, height, Bitmap.Config.Argb8888);

            Canvas canvas = new Canvas(bitmap);

            view.Draw(canvas);

            return(bitmap);
        }
        public void ShowKeyboard(View v)
        {
            IVisualElementRenderer renderer = Platform.CreateRendererWithContext(v, this._context);

            Android.Views.View rendererView = renderer.View;
            renderer.Tracker.UpdateLayout();
            rendererView.Layout(0, 0, (int)v.WidthRequest, (int)v.HeightRequest);

            Android.Views.View child = rendererView;

            if (this._context.GetSystemService(Context.InputMethodService) is InputMethodManager inputMethodManager)
            {
                child.RequestFocus();
                inputMethodManager.ShowSoftInput(child, ShowFlags.Forced);
                inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
            }
        }
Ejemplo n.º 9
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            int containerHeight = b - t;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));

            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                if (child is Toolbar)
                {
                    continue;
                }

                child.Layout(0, 0, r, b);
            }
        }
Ejemplo n.º 10
0
        protected void ArrangeChildOverride(View view, Rect frame)
        {
            LogArrange(view, frame);

            var elt           = view as UIElement;
            var physicalFrame = frame.LogicalToPhysicalPixels();

            try
            {
                elt?.SetFramePriorArrange(frame, physicalFrame);

                view.Layout(
                    (int)physicalFrame.Left,
                    (int)physicalFrame.Top,
                    (int)physicalFrame.Right,
                    (int)physicalFrame.Bottom
                    );
            }
            finally
            {
                elt?.ResetFramePostArrange();
            }
        }
Ejemplo n.º 11
0
        protected void ArrangeChildOverride(View view, Rect frame)
        {
            LogArrange(view, frame);

            var physicalFrame = frame.LogicalToPhysicalPixels();

            try
            {
                SetArrangeLogicalSize(view, frame);
                SetFrameRoundingAdjustment(view, frame, physicalFrame);

                view.Layout(
                    (int)physicalFrame.Left,
                    (int)physicalFrame.Top,
                    (int)physicalFrame.Right,
                    (int)physicalFrame.Bottom
                    );
            }
            finally
            {
                ResetArrangeLogicalSize(view);
            }
        }