Ejemplo n.º 1
0
 protected override void OnAttached()
 {
     try
     {
         if (Control is EditText || Control is PickerEditText)
         {
             Control.Background = new ColorDrawable(Android.Graphics.Color.Transparent);
             Control.SetPadding(25, 0, 25, 0);
         }
         else if (Control is Android.Widget.DatePicker || Control is Android.Widget.Spinner)
         {
             Control.Background = null;
             var datePicker   = Control as Android.Widget.DatePicker;
             var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
             layoutParams.SetMargins(0, 0, 0, 0);
             datePicker.LayoutParameters = layoutParams;
             Control.LayoutParameters    = layoutParams;
             datePicker.SetPadding(25, 0, 25, 0);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Cannot set property on attached control. Error: {0}", ex.Message);
     }
 }
Ejemplo n.º 2
0
 protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         if (e.OldElement == null || e.NewElement != null)
         {
             Control.Background = null;
             var armPicker    = e.NewElement as CustomPicker;
             var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
             layoutParams.SetMargins(0, 0, 0, 0);
             LayoutParameters         = layoutParams;
             Control.LayoutParameters = layoutParams;
             Control.SetPadding(0, 0, 0, 0);
             SetPadding(0, 0, 0, 0);
             Control.TextSize *= (armPicker.FontSize * 0.01f);
             Control.SetHintTextColor(Android.Graphics.Color.ParseColor(armPicker.PlaceholderColor));
             //Control.SetHintTextColor(Android.Graphics.Color.ParseColor(armPicker.PlaceholderColor));
             //Control.Typeface = Typeface.CreateFromAsset(Context.Assets, "OpenSans-Light.ttf");
         }
         if (Control != null)
         {
             Control.Background      = null;
             Element.BackgroundColor = System.Drawing.Color.Transparent;
             Control.Gravity         = GravityFlags.Start;
             Control.TextSize        = 12;
         }
     }
 }
Ejemplo n.º 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.DatePicker> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;
                string fontFamily = e.NewElement?.FontFamily;
                if (!string.IsNullOrEmpty(fontFamily))
                {
                    var      label = (TextView)Control; // for example
                    Typeface font  = Typeface.CreateFromAsset(Forms.Context.Assets, fontFamily + ".otf");
                    label.Typeface = font;
                }
                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);

                BorderlessDatePicker element = Element as BorderlessDatePicker;
                if (!string.IsNullOrWhiteSpace(element.Placeholder))
                {
                    Control.Text = element.Placeholder;
                }
                this.Control.TextChanged += (sender, arg) =>
                {
                    var selectedDate = arg.Text.ToString();
                    if (selectedDate == element.Placeholder)
                    {
                        Control.Text = DateTime.Now.ToString("dd/MM/yyyy");
                    }
                };
            }
        }
Ejemplo n.º 4
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.DatePicker> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                Control.Background = null;
                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters = layoutParams;
                GradientDrawable gd = new GradientDrawable();
                //gd.SetStroke(0, Android.Graphics.Color.Transparent);
                gd.SetColor(Element.BackgroundColor.ToAndroid());
                gd.SetCornerRadius(Context.ToPixels(ElementV2.CornerRadius));
                gd.SetStroke((int)Context.ToPixels(ElementV2.BorderThickness), ElementV2.BorderColor.ToAndroid());

                var padTop    = (int)Context.ToPixels(ElementV2.Padding.Top);
                var padBottom = (int)Context.ToPixels(ElementV2.Padding.Bottom);
                var padLeft   = (int)Context.ToPixels(ElementV2.Padding.Left);
                var padRight  = (int)Context.ToPixels(ElementV2.Padding.Right);

                Control.SetPadding(padLeft, padTop, padRight, padBottom);

                Control.Gravity = GravityFlags.Center;
                Control.SetBackground(gd);
                //Control.SetBackgroundDrawable(gd);
                Control.LayoutParameters = layoutParams;
                //Control.SetPadding(0, 0, 0, 0);
                //SetPadding(0, 0, 0, 0);
            }
        }
Ejemplo n.º 5
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TimePicker> e)
        {
            base.OnElementChanged(e);

            TimePickerDialogIntervals timePickerDlg = new TimePickerDialogIntervals(this.Context, new EventHandler <TimePickerDialogIntervals.TimeSetEventArgs>(UpdateDuration),
                                                                                    Element.Time.Hours, Element.Time.Minutes, true);


            var control = new EditText(this.Context);

            control.Focusable            = false;
            control.FocusableInTouchMode = false;
            control.Clickable            = false;
            control.Click += (sender, ea) => timePickerDlg.Show();
            control.Text   = Element.Time.Hours.ToString("00") + ":" + Element.Time.Minutes.ToString("00");

            if (e.OldElement == null)
            {
                control.Background = null;

                var layoutParams1 = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams1.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams1;
                control.LayoutParameters = layoutParams1;
                control.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);
            }
            SetNativeControl(control);
        }
Ejemplo n.º 6
0
        protected override void OnElementChanged(ElementChangedEventArgs <TimePicker> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;
                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);

                BorderlessTimePicker element = Element as BorderlessTimePicker;

                if (element.Time == TimeSpan.Zero && !String.IsNullOrEmpty(element.Placeholder))
                {
                    Control.Text     = element.Placeholder;
                    textColor        = element.TextColor;
                    placeholderColor = element.PlaceholderColor == default(Color) ? textColor : element.PlaceholderColor;

                    element.TextColor    = placeholderColor;
                    Control.TextChanged += Control_TextChanged;
                }
            }
        }
Ejemplo n.º 7
0
    //Overriden because DrawerLayout need to be measured with MeasureSpecMode EXACLTY
    protected override void MeasureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed)
    {
        MarginLayoutParams lp      = (MarginLayoutParams)child.LayoutParameters;
        int childWidthMeasureSpec  = GetChildMeasureSpec(parentWidthMeasureSpec, PaddingLeft + PaddingRight + lp.LeftMargin + lp.RightMargin + widthUsed, lp.Width);
        int childHeightMeasureSpec = MeasureSpec.MakeMeasureSpec(parentHeightMeasureSpec, MeasureSpecMode.Exactly); //There is only one child and this child has match_parent so we want to make his height equal to this view's height

        child.Measure(childWidthMeasureSpec, childHeightMeasureSpec);
    }
Ejemplo n.º 8
0
        private void RenderDummy()
        {
            var height = Utils.GetAlbumFooterHeight(Resources);
            MarginLayoutParams mParams = new MarginLayoutParams(0, height);

            LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(mParams);
            LayoutParameters = lParams;
        }
Ejemplo n.º 9
0
        protected override void MeasureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed)
        {
            MarginLayoutParams lp      = (MarginLayoutParams)child.LayoutParameters;
            int childWidthMeasureSpec  = GetChildMeasureSpec(parentWidthMeasureSpec, PaddingLeft + PaddingRight + lp.LeftMargin + lp.RightMargin + widthUsed, lp.Width);
            int childHeightMeasureSpec = MeasureSpec.MakeMeasureSpec(lp.TopMargin + lp.BottomMargin, MeasureSpecMode.Unspecified);

            child.Measure(childWidthMeasureSpec, childHeightMeasureSpec);
        }
Ejemplo n.º 10
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);
            var metrics = Resources.DisplayMetrics;
            var width   = metrics.WidthPixels;

            floatingActionButton = new FloatingActionButton(this.Context);
            var          layoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            LayoutParams paramss      = new LayoutParams(
                LayoutParams.WrapContent,
                LayoutParams.WrapContent
                );
            MarginLayoutParams marginLayout = new MarginLayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            marginLayout.SetMargins((int)(width / 2.3), 0, 0, 40);
            floatingActionButton.BackgroundTintList = Context.GetColorStateList(Resource.Color.blueColor);
            floatingActionButton.Click += FloatingActionButton_Click;

            floatingActionButton.LayoutParameters = marginLayout;
            floatingActionButton.SetBackgroundColor(Android.Graphics.Color.Blue);
            floatingActionButton.SetImageResource(Resource.Drawable.plus_white);
            floatingActionButton.SetForegroundGravity(GravityFlags.Center);
            floatingActionButton.Elevation = 6;
            var layout = (GetChildAt(0) as Android.Widget.RelativeLayout);

            RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            p.AddRule(LayoutRules.AlignBottom);

            //layout.AddView(floatingActionButton);
            var bottomNavigationView = (GetChildAt(0) as Android.Widget.RelativeLayout).GetChildAt(1) as BottomNavigationView;

            //ViewGroupUtils.removeView(bottomNavigationView);
            //var b =  LayoutInflater.From(this.Context).Inflate(Resource.Layout.MaterialBottomAppBar, null);
            //layout.AddView(b,1);
            bottomNavigationView.SetClipChildren(false);
            var menuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView;
            BottomNavigationItemView item2 = (BottomNavigationItemView)menuView.GetChildAt(1);
            BottomNavigationItemView item3 = (BottomNavigationItemView)menuView.GetChildAt(2);

            item2.SetPadding(0, 0, 100, 0);
            item3.SetPadding(100, 0, 0, 0);

            //item2.SetPaddingRelative(0, 0, 300, 0);

            //for (int i = 0; i < menuView.ChildCount; i++)
            //{
            //    BottomNavigationItemView item = (BottomNavigationItemView)menuView.GetChildAt(i);
            //    item.SetPadding(0, 0, 50, 0);
            //    //noinspection RestrictedApi
            //    item.SetShifting(false);
            //    // set once again checked value, so view will be updated
            //    //noinspection RestrictedApi
            //    item.SetChecked(item.ItemData.IsChecked);
            //}
            bottomNavigationView.AddView(floatingActionButton);
        }
Ejemplo n.º 11
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            int paddingLeft  = PaddingLeft;
            int paddingRight = PaddingRight;
            int paddingTop   = PaddingTop;
            int x            = mRtl ? (Width - paddingRight) : paddingLeft;
            int y            = paddingTop;

            int rowCount = mChildNumForRow.Count, childIdx = 0;

            for (int row = 0; row < rowCount; row++)
            {
                int   childNum  = mChildNumForRow[row];
                int   rowHeight = mHeightForRow[row];
                float spacing   = mHorizontalSpacingForRow[row];
                for (int i = 0; i < childNum && childIdx < ChildCount;)
                {
                    View child = GetChildAt(childIdx++);
                    if (child.Visibility == ViewStates.Gone)
                    {
                        continue;
                    }
                    else
                    {
                        i++;
                    }

                    LayoutParams childParams = child.LayoutParameters;
                    int          marginLeft = 0, marginTop = 0, marginRight = 0;
                    if (childParams is MarginLayoutParams)
                    {
                        MarginLayoutParams marginParams = (MarginLayoutParams)childParams;
                        marginLeft  = marginParams.LeftMargin;
                        marginRight = marginParams.RightMargin;
                        marginTop   = marginParams.TopMargin;
                    }

                    int childWidth  = child.MeasuredWidth;
                    int childHeight = child.MeasuredHeight;
                    if (mRtl)
                    {
                        child.Layout(x - marginRight - childWidth, y + marginTop,
                                     x - marginRight, y + marginTop + childHeight);
                        x -= (int)(childWidth + spacing + marginLeft + marginRight);
                    }
                    else
                    {
                        child.Layout(x + marginLeft, y + marginTop,
                                     x + marginLeft + childWidth, y + marginTop + childHeight);
                        x += (int)(childWidth + spacing + marginLeft + marginRight);
                    }
                }
                x  = mRtl ? (Width - paddingRight) : paddingLeft;
                y += (int)(rowHeight + mAdjustedRowSpacing);
            }
        }
 protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         Control.Background = null;
         var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
         layoutParams.SetMargins(0, 0, 0, 0);
         LayoutParameters = layoutParams;
     }
 }
Ejemplo n.º 13
0
 public ChallengesCollectionViewHolder(View itemView, IMvxAndroidBindingContext context) : base(itemView, context)
 {
     mainView = itemView.FindViewById <ConstraintLayout>(Resource.Id.main_view);
     icon     = itemView.FindViewById <ImageView>(Resource.Id.icon);
     if (icon != null)
     {
         icon.SetColorFilter(new Color(ContextCompat.GetColor(Application.Context, Resource.Color.textIcon)), PorterDuff.Mode.SrcIn);
     }
     marginParams = mainView.LayoutParameters as MarginLayoutParams;
     FontHelper.UpdateFont(itemView.FindViewById <TextView>(Resource.Id.top_text), FontsConstants.PN_R, (float)0.03);
     FontHelper.UpdateFont(itemView.FindViewById <TextView>(Resource.Id.bottom_text), FontsConstants.PN_B, (float)0.035);
 }
Ejemplo n.º 14
0
        protected override void OnElementChanged(ElementChangedEventArgs <Editor> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Gravity = GravityFlags.Center;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters = layoutParams;
            }
        }
Ejemplo n.º 15
0
        void updateBorder()
        {
            Control.Background = null;

            var layoutParams = new MarginLayoutParams(Control.LayoutParameters);

            layoutParams.SetMargins(0, 0, 0, 0);
            LayoutParameters         = layoutParams;
            Control.LayoutParameters = layoutParams;
            Control.SetPadding(0, 0, 0, 0);
            SetPadding(0, 0, 0, 0);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            var newCustomEntryKeyboard = e.NewElement as EntryWithCustomKeyboard;
            var oldCustomEntryKeyboard = e.OldElement as EntryWithCustomKeyboard;

            if (newCustomEntryKeyboard == null && oldCustomEntryKeyboard == null)
            {
                return;
            }

            if (e.NewElement != null)
            {
                this.entryWithCustomKeyboard = newCustomEntryKeyboard;
                this.CreateCustomKeyboard();

                this.inputTypeToUse = this.entryWithCustomKeyboard.Keyboard.ToInputType() |
                                      InputTypes.TextFlagNoSuggestions;

                // Here we set the EditText event handlers
                this.EditText.FocusChange += Control_FocusChange;
                this.EditText.TextChanged += EditText_TextChanged;
                this.EditText.Click       += EditText_Click;
                this.EditText.Touch       += EditText_Touch;

                this.EditText.Background = null;
                var lp = new MarginLayoutParams(Control.LayoutParameters);
                lp.SetMargins(0, 0, 0, 10);
                LayoutParameters         = lp;
                Control.LayoutParameters = lp;
                this.EditText.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);
            }

            // Dispose control
            if (e.OldElement != null)
            {
                this.EditText.FocusChange -= Control_FocusChange;
                this.EditText.TextChanged -= EditText_TextChanged;
                this.EditText.Click       -= EditText_Click;
                this.EditText.Touch       -= EditText_Touch;

                this.EditText.Background = null;
                var lp = new MarginLayoutParams(Control.LayoutParameters);
                lp.SetMargins(0, 0, 0, 10);
                LayoutParameters         = lp;
                Control.LayoutParameters = lp;
                this.EditText.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Change entry properties here
        /// </summary>
        /// <param name="e"></param>
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.TextAlignment    = Android.Views.TextAlignment.Gravity;
            }
        }
Ejemplo n.º 18
0
 protected override void OnElementChanged(ElementChangedEventArgs <TimePicker> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         Control.SetBackgroundResource(Resource.Layout.rounded_shape);
         var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
         layoutParams.SetMargins(0, 0, 0, 0);
         LayoutParameters         = layoutParams;
         Control.LayoutParameters = layoutParams;
         Control.SetPadding(0, 0, 0, 0);
         SetPadding(0, 0, 0, 0);
     }
 }
Ejemplo n.º 19
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TimePicker> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(15, 15, 15, 15);
                SetPadding(0, 0, 0, 0);
            }
        }
Ejemplo n.º 20
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var lp = new MarginLayoutParams(Control.LayoutParameters);
                lp.SetMargins(0, 0, 0, 0);
                LayoutParameters         = lp;
                Control.LayoutParameters = lp;
                Control.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);
            }
        }
Ejemplo n.º 21
0
 protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         Control.Background = null;
         Control.SetTextSize(Android.Util.ComplexUnitType.Dip, (float)e.NewElement.FontSize);
         var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
         layoutParams.SetMargins(0, 0, 0, 0);
         LayoutParameters         = layoutParams;
         Control.LayoutParameters = layoutParams;
         Control.SetPadding(0, 0, 0, 0);
         SetPadding(0, 0, 0, 0);
     }
 }
Ejemplo n.º 22
0
        protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters = layoutParams;
                GradientDrawable gd = new GradientDrawable();
                gd.SetStroke(0, Android.Graphics.Color.Transparent);
                Control.SetBackgroundDrawable(gd);
                Control.LayoutParameters = layoutParams;
            }
        }
Ejemplo n.º 23
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Xamarin.Forms.TimePicker> e)
        {
            base.OnElementChanged(e);

            CustomTimePicker timePicker = (CustomTimePicker)Element;


            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
            }
        }
Ejemplo n.º 24
0
        protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e)
        {
            base.OnElementChanged(e);

            CustomDatePicker datePicker = (CustomDatePicker)Element;


            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
            }
        }
Ejemplo n.º 25
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(0, 0, 0, 0);
                Control.SetBackgroundColor(Color.Transparent.ToAndroid());
                SetPadding(0, 0, 0, 0);
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(0, 0, 0, 0);
                Control.Gravity = Android.Views.GravityFlags.CenterVertical;
                SetPadding(0, 0, 0, 0);
            }
        }
        private void SetControl()
        {
            if (Control == null)
            {
                return;
            }

            Control.Background = new ColorDrawable(Color.Transparent.ToAndroid());
            Control.SetPadding(0, 0, 0, 0);
            Control.SetIncludeFontPadding(false);
            Control.SetMinimumHeight((int)MaterialHelper.ConvertToDp(20));

            var layoutParams = new MarginLayoutParams(Control.LayoutParameters);

            layoutParams.SetMargins(0, 0, 0, 0);
            Control.LayoutParameters = layoutParams;
        }
Ejemplo n.º 28
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                Control.Background = null;

                var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
                layoutParams.SetMargins(0, 0, 0, 0);
                LayoutParameters         = layoutParams;
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(0, 0, 0, 0);
                SetPadding(0, 0, 0, 0);

                //var item=  Resource.Layout.Layout;
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (e == null)
            {
                return;
            }

            Control.SetBackgroundColor(Android.Graphics.Color.Transparent);
            using (var layoutParams = new MarginLayoutParams(Control.LayoutParameters))
            {
                layoutParams.SetMargins(0, 0, 0, 0);
                Control.LayoutParameters = layoutParams;
                Control.SetPadding(Control.Left, 0, Control.Right, 0);
            }
        }
 private void SetBorder(BorderlessEntry view)
 {
     if (view == null || Control == null)
     {
         return;
     }
     if (!view.HasBorder)
     {
         Control.Background = null;
         var layoutParams = new MarginLayoutParams(Control.LayoutParameters);
         layoutParams.SetMargins(0, 0, 0, 0);
         LayoutParameters         = layoutParams;
         Control.LayoutParameters = layoutParams;
         Control.SetPadding(0, 0, 0, 0);
         SetPadding(0, 0, 0, 0);
     }
 }
Ejemplo n.º 31
0
 public LayoutParams(MarginLayoutParams source)
     : base(source) { }
Ejemplo n.º 32
0
						public MarginLayoutParams(MarginLayoutParams marginLayoutParams) /* MethodBuilder.Create */ 
						{
						}
Ejemplo n.º 33
0
 //initial hide and set listener
 protected override void OnLayout(bool changed, int l, int t, int r, int b)
 {
     base.OnLayout (changed, l, t, r, b);
     if (changed && !loadOnce) {
         hideHeaderHeight = -header.Height;
         headerLayoutParams = (MarginLayoutParams) header.LayoutParameters;
         headerLayoutParams.TopMargin = hideHeaderHeight;
         header.LayoutParameters = headerLayoutParams;
         scrollview = (ScrollView) GetChildAt(1);
         scrollview.SetOnTouchListener(this);
         loadOnce = true;
     }
 }