当前位置: 首页>>代码示例>>C#>>正文


C# RelativeLayout.ForceLayout方法代码示例

本文整理汇总了C#中RelativeLayout.ForceLayout方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.ForceLayout方法的具体用法?C# RelativeLayout.ForceLayout怎么用?C# RelativeLayout.ForceLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RelativeLayout的用法示例。


在下文中一共展示了RelativeLayout.ForceLayout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XFPage3

        public XFPage3()
        {
            var layout = new RelativeLayout();
            var label = new Label()
            {
                Text = "This is a line of text!"
            };
            layout.Children.Add(label, Constraint.Constant(0),
                Constraint.RelativeToParent(parent => parent.Height / 2));

            var label2 = new Label() { Text = "More text over here!" };

            layout.Children.Add(label2, Constraint.RelativeToView(label, (parent, otherView) => otherView.X + otherView.Width), Constraint.RelativeToView(label, (parent, otherView) => otherView.Y - otherView.Height));

            var label3 = new Label() { Text = "Final text" };

            layout.Children.Add(label3, Constraint.RelativeToView(label2, (parent, otherView) =>
            {
                return (otherView.X + otherView.Width) - label3.Width;
            }),
                Constraint.RelativeToView(label, (parent, otherView) => { return otherView.Y; }));

            label3.SizeChanged += (o, e) => { layout.ForceLayout(); };

            Content = layout;
        }
开发者ID:mkonkolowicz,项目名称:KnockKnock,代码行数:26,代码来源:XFPage3.cs

示例2: Profile


//.........这里部分代码省略.........

            relativeLayout.Children.Add(
                twitterimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .05;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                linkedinimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .95 - (parent.Width * .15);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                face,
                Constraint.RelativeToParent((parent) =>
                {
                    return ((parent.Width / 2) - (face.Width / 2));
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .1;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                })
            );

            relativeLayout.Children.Add(
                details,
                Constraint.Constant(0),
                Constraint.RelativeToView(dome, (parent, view) =>
                {
                    return view.Y + view.Height + 10;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.Constant(200)
            );

            relativeLayout.Children.Add(
                    slideshow,
                    Constraint.Constant(0),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        return view.Y + view.Height;
                    }),
                    Constraint.RelativeToParent((parent) =>
                    {
                        return parent.Width;
                    }),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        var detailsbottomY = view.Y + view.Height;
                        return parent.Height - detailsbottomY;
                    })
                );

            face.SizeChanged += (sender, e) =>
            {
                relativeLayout.ForceLayout();
            };

            this.Content = relativeLayout;
        }
开发者ID:segmond,项目名称:CPXamarin,代码行数:101,代码来源:Profile.cs

示例3: Register


//.........这里部分代码省略.........
                        },

                        new EntryCell{
                            Placeholder = "Correo",
                            Keyboard = Keyboard.Email
                        }
                    }
                }
            };

            Button Registrar = new Button {
                Text = "Registrar",
                WidthRequest = 290,
                BackgroundColor = Color.FromRgb(210,34,70),
                TextColor = Color.White
            };

            RelativeLayout relLayout2 = new RelativeLayout();

            relLayout2.Children.Add ((Registrate),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width/2 - Registrate.Width/2;
                }),
                Constraint.RelativeToParent((parent) => {
                    return 10;
                }));

            relLayout2.Children.Add ((FacebookAcc),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width/2 - FacebookAcc.Width/2;
                }),
                Constraint.RelativeToParent((parent) => {
                    return parent.Height/7;
                }));

            relLayout2.Children.Add ((GoogleAcc),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - GoogleAcc.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height / 7 + FacebookAcc.Height + 10;
                }));

            relLayout2.Children.Add ((IngresaDat),
                Constraint.RelativeToParent ((parent) => {
                    return FacebookAcc.X;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return GoogleAcc.Y + 80;
                }));

            relLayout2.Children.Add ((Nombre),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - Nombre.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return IngresaDat.Y + 50;
                }));

            relLayout2.Children.Add ((Apellido),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - Apellido.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return Nombre.Y + 40;
                }));

            relLayout2.Children.Add ((Celular),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - Celular.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return Apellido.Y + 40;
                }));

            relLayout2.Children.Add ((Correo),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - Correo.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return Celular.Y + 40;
                }));

            relLayout2.Children.Add ((Registrar),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width / 2 - Registrar.Width / 2;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return Correo.Y + 60;
                }));

            //para que se centre en el relativelayout (tomando en cuenta el width del label,etc)
            Registrate.SizeChanged += ((sender, eventArgs) =>
                {
                    relLayout2.ForceLayout();
                });

            Content = relLayout2;
            Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);
        }
开发者ID:lgdelgadom,项目名称:testAppv01,代码行数:101,代码来源:register.cs

示例4: welcome

		public welcome ()
		{
			Label header = new Label {
				Text = "Xylo",
				FontSize = 70,
				FontAttributes= FontAttributes.Bold,
				FontFamily="Avenir"
			};

			Button IniciarSes = new Button {
				Text = "Iniciar Sesión",
				TextColor = Color.White,
				BackgroundColor = Color.FromRgb(255,135,20),
				WidthRequest = 275
			};

			Button Registrate = new Button {
				Text = "Regístrate",
				TextColor = Color.White,
				BackgroundColor = Color.FromRgb (245, 104, 78),
				WidthRequest = 275,

			};

			RelativeLayout relLayout1 = new RelativeLayout();

			relLayout1.Children.Add(header,
				Constraint.RelativeToParent((parent) => {
					return (parent.Width / 2) - (header.Width/2.0);
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Height/3 + 20;
				}));

			relLayout1.Children.Add (Registrate,
				Constraint.RelativeToParent ((parent) => {
					return (parent.Width / 2) - (Registrate.Width/2.0);
				}),
				Constraint.RelativeToParent((parent)=> {
					return parent.Height*0.75 - IniciarSes.Height - 10;
				}));

			relLayout1.Children.Add (IniciarSes,
				Constraint.RelativeToParent ((parent) => {
					return (parent.Width / 2) - (IniciarSes.Width/2.0);
				}),
				Constraint.RelativeToParent((parent)=> {
					return parent.Height*0.75;
				}));

			//para que se centre en el relativelayout (tomando en cuenta el width del label,etc)
			header.SizeChanged += ((sender, eventArgs) =>
				{
					relLayout1.ForceLayout();
				});

			Registrate.Clicked += OnNextPageButtonClicked;

			Content = new StackLayout { 
				Children = {
					relLayout1
				}
			};
		}
开发者ID:lgdelgadom,项目名称:testAppv01,代码行数:64,代码来源:welcome.cs

示例5: DashWidgetView

		public DashWidgetView (DashSquare square)
		{
			RelativeLayout layout = new RelativeLayout ();

			var tapGestureRecognizer = new TapGestureRecognizer();
			tapGestureRecognizer.Tapped += (s, e) => {
				EventHandler<WidgetTappedEventArgs> handler = Tapped;

				if (handler != null)
				{
					handler(this, new WidgetTappedEventArgs(square.NavigateType));
				}
			};
			layout.GestureRecognizers.Add(tapGestureRecognizer);

			var backgroundImage = new Image () { 
				Source = new FileImageSource () { File = square.BackgroundImage },
				Aspect = Aspect.AspectFill,
				InputTransparent = false
			};

			layout.Children.Add (backgroundImage, 
				Constraint.Constant (0), 
				Constraint.Constant (0),
				Constraint.RelativeToParent ((parent) => {
					return parent.Width;
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Height;
				}));

			var iconImage = new Image () { 
				Source = new FileImageSource () { File = square.IconImage },
				InputTransparent = true
			};

			layout.Children.Add (
				iconImage, 
				Constraint.RelativeToParent ((parent) => {
					return ((parent.Width / 2) - (iconImage.Width / 2));
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Height * .25;
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Width * .45;
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Width * .45;
				})
			);

			iconImage.SizeChanged += (sender, e) => {
				layout.ForceLayout ();
			};

			var dashlabel = new Label () {
				Text = square.Text,
				XAlign = TextAlignment.Center,
				TextColor = Color.White,
				FontFamily = Device.OnPlatform ("AvenirNextCondensed-Bold", "sans-serif-condensed", null),
				InputTransparent = true
			};

			layout.Children.Add (dashlabel, 
				Constraint.Constant (0), 
				Constraint.RelativeToParent ((parent) => {
					return parent.Height - 30;
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Width;
				}),
				Constraint.RelativeToParent ((parent) => {
					return parent.Height;
				}));

			Content = layout;
		}
开发者ID:Sway0308,项目名称:Xamarin-Forms-InAnger,代码行数:78,代码来源:DashWidgetView.cs

示例6: Page4


//.........这里部分代码省略.........

            var face = new Image () {
                Aspect = Aspect.AspectFill,
                Source = new FileImageSource () { File = "face.jpg" }
            };

            var dome = new Image () {
                Aspect = Aspect.AspectFill,
                Source = new FileImageSource () { File = "dome.png" }
            };

            var chatimage = new Image () {
                Source = new FileImageSource () { File = "chat.png" }
            };

            var pindropimage = new Image () {
                Source = new FileImageSource () { File = "pindrop.png" }
            };

            var details = new DetailsView ();
            var slideshow = new SlideShowView ();

            RelativeLayout relativeLayout = new RelativeLayout () {
                HeightRequest = 100,
            };

            relativeLayout.Children.Add (
                backgroundImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .5;
                })
            );

            relativeLayout.Children.Add (
                shader,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .5;
                })
            );

            relativeLayout.Children.Add (
                dome,
                Constraint.Constant (-10),
                Constraint.RelativeToParent ((parent) => {
                    return (parent.Height * .5) - 50;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width + 10;
                }),
                Constraint.Constant (75)
            );

            relativeLayout.Children.Add (
                chatimage,
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .05;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return (parent.Height * .5);
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add (
                face,
                Constraint.RelativeToParent ((parent) => {
                    return ((parent.Width / 2) - (face.Width / 2));
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .25;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .5;
                })
            );

            face.SizeChanged += (sender, e) => {
                relativeLayout.ForceLayout ();
            };

            this.Content = relativeLayout;
        }
开发者ID:alleeclark,项目名称:morganHack,代码行数:101,代码来源:Page4.cs

示例7: App

        public App()
        {
            var layout = new RelativeLayout();

            var label = new Label
            {
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                Text = "Hello Floating Action Button!"
            };
            layout.Children.Add(
                label,
                xConstraint: Constraint.Constant(0),
                yConstraint: Constraint.Constant(0),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height)
            );

            var normalFab = new FAB.Forms.FloatingActionButton();
            normalFab.Source = "plus.png";
            normalFab.Size = FabSize.Normal;

            layout.Children.Add(
                normalFab,
                xConstraint: Constraint.RelativeToParent((parent) =>  { return (parent.Width - normalFab.Width) - 16; }),
                yConstraint: Constraint.RelativeToParent((parent) =>  { return (parent.Height - normalFab.Height) - 16; })
            );

            normalFab.SizeChanged += (sender, args) => { layout.ForceLayout(); };

            var miniFab = new FAB.Forms.FloatingActionButton();
            miniFab.Source = "plus.png";
            miniFab.Size = FabSize.Mini;

            layout.Children.Add(
                miniFab,
                xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return (parent.Width - miniFab.Width) - 16;
                    }),
                yConstraint: Constraint.RelativeToView(normalFab, (parent, view) =>
                    {
                        return (view.Y - miniFab.Height) - 16;
                    })
            );
            miniFab.SizeChanged += (sender, args) => { layout.ForceLayout(); };

            // The root page of your application
            MainPage = new ContentPage
            {
                BackgroundColor = Color.White,
                Content = layout
            };

            normalFab.Clicked += (sender, e) =>
                {
                    MainPage.DisplayAlert("Floating Action Button", "You clicked the normal FAB!", "Awesome!");
                };

            miniFab.Clicked += (sender, e) =>
                {
                    MainPage.DisplayAlert("Floating Action Button", "You clicked the mini FAB!", "Awesome!");
                };
        }
开发者ID:harrysaggu,项目名称:xamarin-plugins,代码行数:64,代码来源:FAB.Forms.Sample.cs

示例8: Profile


//.........这里部分代码省略.........
            relativeLayout.Children.Add(
                chatimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .05;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                pindropimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .95 - (parent.Width * .15);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                face,
                Constraint.RelativeToParent((parent) =>
                {
                    return ((parent.Width / 2) - (face.Width / 2));
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .1;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                })
            );

            relativeLayout.Children.Add(
                details,
                Constraint.Constant(0),
                Constraint.RelativeToView(dome, (parent, view) =>
                {
                    return view.Y + view.Height + 10;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.Constant(200)
            );

            relativeLayout.Children.Add(
                    slideshow,
                    Constraint.Constant(0),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        return view.Y + view.Height;
                    }),
                    Constraint.RelativeToParent((parent) =>
                    {
                        return parent.Width;
                    }),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        var detailsbottomY = view.Y + view.Height;
                        return parent.Height - detailsbottomY;
                    })
                );

            face.SizeChanged += (sender, e) =>
            {
                relativeLayout.ForceLayout();
            };

            this.Content = relativeLayout;

        }
开发者ID:asthanarht,项目名称:CodeProject,代码行数:101,代码来源:Profile.cs

示例9: LoginPage


//.........这里部分代码省略.........
            Label lblLogin = new Label () {
                Text = "Gelieve in te loggen met je Microsoft account",
                FontSize = 12,
                FontFamily = Device.OnPlatform("HelveticaNeue-Light","sans-serif-light",null),
                XAlign = TextAlignment.Center,
                TextColor = Color.FromHex("#666")
            };

            Button btnLogin = new Button {
                Text = "Log in",
                TextColor = Device.OnPlatform (Color.Black, Color.White, Color.White),
                FontFamily = Device.OnPlatform("HelveticaNeue","sans-serif",null),
                IsEnabled = !SyncController.Instance.HasNeverBeenSynced()
            };

            btnLogin.Clicked += BtnLogin_OnClicked;

            ContentView details = new ContentView () {
                Content = new StackLayout () {
                    Padding = new Thickness(20,10),
                    Children = {
                        lblWelcome,
                        lblLogin,
                        btnLogin
                    }
                }
            };

            relativeLayout = new RelativeLayout () {
                HeightRequest = 100,
            };

            relativeLayout.Children.Add (
                imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .5;
                })
            );

            relativeLayout.Children.Add (
                shader,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .5;
                })
            );

            relativeLayout.Children.Add (
                imgDome,
                Constraint.Constant (-10),
                Constraint.RelativeToParent ((parent) => {
                    return (parent.Height * .5) - 50;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width + 10;
                }),
                Constraint.Constant (75)
            );

            relativeLayout.Children.Add (
                imgFace,
                Constraint.RelativeToParent ((parent) => {
                    return ((parent.Width / 2) - (imgFace.Width / 2));
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height * .25;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width * .5;
                })
            );

            relativeLayout.Children.Add (
                details,
                Constraint.Constant (0),
                Constraint.RelativeToView (imgDome, (parent, view) => {
                    return view.Y + view.Height + 10;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.Constant (120)
            );

            imgFace.SizeChanged += (sender, e) => {
                relativeLayout.ForceLayout ();
            };
        }
开发者ID:KennyDeblaere,项目名称:Burocenter,代码行数:101,代码来源:LoginPage.cs


注:本文中的RelativeLayout.ForceLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。