zoukankan      html  css  js  c++  java
  • XF相对控件布局

    using System;
    using Xamarin.Forms;
    using Xamarin.Forms.Xaml;

    [assembly: XamlCompilation (XamlCompilationOptions.Compile)]
    namespace App6
    {
        public partial class App : Application
        {
            public App ()
            {
                InitializeComponent();
                BoxView bv = new BoxView { Color = Color.Red, WidthRequest = 150, HeightRequest = 150 };
                Label lbl = new Label { Text = "这是一个红色的方块", TextColor = Color.Red };
                RelativeLayout rl = new RelativeLayout();
                rl.Children.Add(bv,Constraint.RelativeToParent((parent)=>parent.Width/2),Constraint.RelativeToParent((parent)=>parent.Height/2));
                rl.Children.Add(lbl, Constraint.RelativeToView(bv, (parent, sibling) => sibling.X+bv.Width), Constraint.RelativeToView(bv, (parent, sibling) => sibling.Y));
                

                MainPage = new ContentPage { Content=rl};
            }

            protected override void OnStart ()
            {
                // Handle when your app starts
            }

            protected override void OnSleep ()
            {
                // Handle when your app sleeps
            }

            protected override void OnResume ()
            {
                // Handle when your app resumes
            }
        }
    }
     

  • 相关阅读:
    【Springboot】Springboot整合Ehcache
    时间戳转化正常的时间格式
    申请抖音企业认证流程
    js与原生进行交互
    vim 高亮
    shell 关于路径查询显示pwd
    shell 关于字符切割 cut
    linux ubuntu 关于vim得一些基本命令
    shell 在终端中打开另一个终端执行命令
    shell 获取时间
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434591.html
Copyright © 2011-2022 走看看