Пример #1
0
 public static void AddRight(this RelativeLayout.IRelativeList <View> layout, View view, int width, int height, int x, int y)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) =>
     {
         return(arg.Width - width - x);
     }),
                yConstraint: Constraint.RelativeToParent((arg) =>
     {
         return(y);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (width >= 0)
         {
             return(width > 0 ? width : arg.Width - x * 2);
         }
         else
         {
             return(arg.Width + width);
         }
     }),
                heightConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (height >= 0)
         {
             return(height > 0 ? height : arg.Height - y * 2);
         }
         return(arg.Height + height);
     }));
 }
Пример #2
0
 public static void AddLeftAfter(this RelativeLayout.IRelativeList <View> layout, View view, View prev, int width, int height, int x, int y)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (x > 0)
         {
             return(x);
         }
         return(arg.Width + x);
     }),
                yConstraint: Constraint.RelativeToView(prev, (parent, arg) =>
     {
         return(arg.Y + arg.Height + y);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (width >= 0)
         {
             return(width > 0 ? width : arg.Width - x * 2);
         }
         return(arg.Width + width);
     }),
                heightConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (height >= 0)
         {
             return(height > 0 ? height : arg.Height - y * 2);
         }
         return(arg.Height + height);
     }));
 }
Пример #3
0
 public static void AddInOrigo(this RelativeLayout.IRelativeList <View> layout, View view, int width, int height)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (width > 0)
         {
             return((arg.Width - width) / 2);
         }
         return(0 - width / 2);
     }),
                yConstraint: Constraint.RelativeToParent((arg) =>
     {
         if (height > 0)
         {
             return((arg.Height - height) / 2);
         }
         return(0 - height / 2);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) =>
     {
         return(width > 0 ? width : arg.Width + width);
     }),
                heightConstraint: Constraint.RelativeToParent((arg) =>
     {
         return(height > 0 ? height : arg.Height);
     }));
 }
Пример #4
0
        public static View AddAsRelative(this RelativeLayout.IRelativeList <View> self,
                                         View view,
                                         Func <RelativeLayout, double> X = null,
                                         Func <RelativeLayout, double> Y = null,
                                         Func <RelativeLayout, double> W = null,
                                         Func <RelativeLayout, double> H = null)
        {
            self.Add(view, X.Let(), Y.Let(), W.Let(), H.Let());

            return(view);
        }
Пример #5
0
        /// <summary>
        /// Append view element to RelativeLayout (more convenient to use). Its recommended
        /// </summary>
        /// <param name="self">RelativeLayout.IRelativeList<View> Children</param>
        /// <param name="view">view for additional to RelativeLayout</param>
        /// <param name="x">x constant</param>
        /// <param name="y">y constant</param>
        /// <param name="W">w - func</param>
        /// <param name="H">h - func</param>
        public static View AddAsRelative(this RelativeLayout.IRelativeList <View> self,
                                         View view,
                                         double x = 0,
                                         double y = 0,
                                         Func <RelativeLayout, double> W = null,
                                         Func <RelativeLayout, double> H = null)
        {
            self.Add(view,
                     Constraint.Constant(x),
                     Constraint.Constant(x),
                     W != null ? Constraint.RelativeToParent(W) : null,
                     H != null ? Constraint.RelativeToParent(H) : null);

            return(view);
        }
Пример #6
0
 public static void AddAfter(this RelativeLayout.IRelativeList <View> layout, View view, View prev, int width, int y)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) => {
         if (width > 0)
         {
             return((arg.Width - width) / 2);
         }
         return(0 - width / 2);
     }),
                yConstraint: Constraint.RelativeToView(prev, (parent, arg) => {
         return(arg.Y + arg.Height + y);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) => {
         return(width > 0 ? width : arg.Width + width);
     }));
 }
Пример #7
0
 public static void AddCentered(this RelativeLayout.IRelativeList <View> layout, View view, int width, int y)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) => {
         if (width > 0)
         {
             return((arg.Width - width) / 2);
         }
         return(0 - width / 2);
     }),
                yConstraint: Constraint.RelativeToParent((arg) => {
         return(y);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) => {
         return(width > 0 ? width : arg.Width + width);
     }));
 }
Пример #8
0
 public static void AddLeft(this RelativeLayout.IRelativeList <View> layout, View view, int width, int x, int y)
 {
     layout.Add(view,
                xConstraint: Constraint.RelativeToParent((arg) => {
         if (x > 0)
         {
             return(x);
         }
         return(arg.Width - width + x);
     }),
                yConstraint: Constraint.RelativeToParent((arg) => {
         return(y);
     }),
                widthConstraint: Constraint.RelativeToParent((arg) => {
         if (width >= 0)
         {
             return(width > 0 ? width : arg.Width - x * 2);
         }
         return(arg.Width + width);
     }));
 }
 public static void AddInOrigo(this RelativeLayout.IRelativeList <View> layout, View view, int width, int height) => layout.Add(view,
                                                                                                                                xConstraint: Constraint.RelativeToParent(arg => width > 0 ? (arg.Width - width) / 2 : 0 - (width / 2)),
                                                                                                                                yConstraint: Constraint.RelativeToParent(arg => height > 0 ? (arg.Height - height) / 2 : 0 - (height / 2)),
                                                                                                                                widthConstraint: Constraint.RelativeToParent(arg => width > 0 ? width : arg.Width + width),
                                                                                                                                heightConstraint: Constraint.RelativeToParent(arg => height > 0 ? height : arg.Height));
Пример #10
0
 public static void AddAfter(this RelativeLayout.IRelativeList <View> layout, View view, View prev, int width, int y) => layout.Add(view,
                                                                                                                                    xConstraint: Constraint.RelativeToParent(arg => width > 0 ? (arg.Width - width) / 2 : 0 - (width / 2)),
                                                                                                                                    yConstraint: Constraint.RelativeToView(prev, (parent, arg) => arg.Y + arg.Height + y),
                                                                                                                                    widthConstraint: Constraint.RelativeToParent(arg => width > 0 ? width : arg.Width + width));
Пример #11
0
 public static void AddLeft(this RelativeLayout.IRelativeList <View> layout, View view, int width, int height, int x, int y) => layout.Add(view,
                                                                                                                                           xConstraint: Constraint.RelativeToParent(arg => x),
                                                                                                                                           yConstraint: Constraint.RelativeToParent(arg => y),
                                                                                                                                           widthConstraint: Constraint.RelativeToParent(arg => width >= 0 ? (width > 0 ? width : arg.Width - (x * 2)) : arg.Width + width),
                                                                                                                                           heightConstraint: Constraint.RelativeToParent(arg => height >= 0 ? (height > 0 ? height : arg.Height - (y * 2)) : arg.Height + height));
Пример #12
0
 public static void AddCentered(this RelativeLayout.IRelativeList <View> layout, View view, int width, int y) => layout.Add(view,
                                                                                                                            xConstraint: Constraint.RelativeToParent(arg => width > 0 ? (arg.Width - width) / 2 : 0 - (width / 2)),
                                                                                                                            yConstraint: Constraint.RelativeToParent(arg => y),
                                                                                                                            widthConstraint: Constraint.RelativeToParent(arg => width > 0 ? width : arg.Width + width));
Пример #13
0
 public static void AddRightAfter(this RelativeLayout.IRelativeList <View> layout, View view, View prev, int width, int height, int x, int y) => layout.Add(view,
                                                                                                                                                            xConstraint: Constraint.RelativeToParent(arg => arg.Width - width - x),
                                                                                                                                                            yConstraint: Constraint.RelativeToView(prev, (parent, arg) => arg.Y + arg.Height + y),
                                                                                                                                                            widthConstraint: Constraint.RelativeToParent(arg => width >= 0 ? (width > 0 ? width : arg.Width - (x * 2)) : arg.Width + width),
                                                                                                                                                            heightConstraint: Constraint.RelativeToParent(arg => height >= 0 ? (height > 0 ? height : arg.Height - (y * 2)) : arg.Height + height));
Пример #14
0
 public static void AddRight(this RelativeLayout.IRelativeList <View> layout, View view, int width, int x, int y) => layout.Add(view,
                                                                                                                                xConstraint: Constraint.RelativeToParent(arg => arg.Width - width - x),
                                                                                                                                yConstraint: Constraint.RelativeToParent(arg => y),
                                                                                                                                widthConstraint: Constraint.RelativeToParent(arg => width >= 0 ? (width > 0 ? width : arg.Width - (x * 2)) : arg.Width + width));