using System;

using Xamarin.Forms;

using Xamarin.Forms.Xaml;

[assembly: XamlCompilation (XamlCompilationOptions.Compile)]

namespace App6

{

    public partial class App : Application

    {

        public App ()

        {

            InitializeComponent();

RelativeLayout rl = new RelativeLayout();

            rl.Children.Add(new BoxView { Color = Color.Blue, WidthRequest = 150, HeightRequest = 150 }, Constraint.Constant(0), Constraint.Constant(0));

            rl.Children.Add(new BoxView { Color = Color.Red, WidthRequest = 150, HeightRequest = 150 }, Constraint.RelativeToParent((Parent)=>Parent.Width-150), Constraint.Constant(0));

            rl.Children.Add(new BoxView { Color = Color.Purple, WidthRequest = 150, HeightRequest = 150 }, Constraint.Constant(0), Constraint.RelativeToParent((Parent) => Parent.Height - 150));

            rl.Children.Add(new BoxView { Color = Color.Yellow, WidthRequest = 150, HeightRequest = 150 }, Constraint.RelativeToParent((Parent) => Parent.Width - 150), Constraint.RelativeToParent((Parent) => Parent.Height - 150));

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

        }

    }

}

XF相对布局的更多相关文章

  1. XF 绝对布局

    using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; [assembly: XamlCompilation (XamlCompila ...

  2. XF相对控件布局

    using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; [assembly: XamlCompilation (XamlCompila ...

  3. Android 布局简要范例

    Android的布局决定着实际的UI界面呈现情况,正是这些UI界面的组合与千变万化,才呈现出了各式各样的风格. 而这些基础的布局框架结构很重要,需要玩的很熟悉.我将以前参考的部分代码示例,所做的相关实 ...

  4. html 布局;css3+jq 下拉菜单;table分页动态添加行;html5本地存储;简单易用的html框架

    简单好用的html框架,预览图见最后: 源码: 1.页面布局使用table: table 嵌套 +iframe 布局: 2.下拉菜单为jq+css3 动画; css input 无边框,select下 ...

  5. 【转】Android 布局学习之——LinearLayout属性baselineAligned的作用及baseline

    相信大家对LinearLayout已经相当熟悉,但你们是否了解它的属性baselineAligned呢? Android官方文档是这么描述的:

  6. Qt入门(6)——Qt的界面布局

    Qt提供四种布局: VBoxLayout:垂直布局 HBoxLayout:水平布局 GridLayout:二维布局. FormLayout: 窗体布局

  7. 安卓---achartengine图表----简单调用----使用view显示在自己的布局文件中----actionBar的简单设置

    AChartEngine 是一个安卓系统上制作图表的框架,关于它的介绍大家可以百度,也可以参考下面这篇博客http://blog.csdn.net/lk_blog/article/details/76 ...

  8. Xamarin自定义布局系列——瀑布流布局

    Xamarin.Forms以Xamarin.Android和Xamarin.iOS等为基础,自己实现了一整套比较完整的UI框架,包含了绝大多数常用的控件,如下图 虽然XF(Xamarin.Forms简 ...

  9. HelloWorld改编,仿bilibili手机端(一)——侧滑菜单界面布局

    讲解目录: 1.要实现的效果图展示及详细分析HelloWorld项目的xml布局文件(基于navigation drawer activity)        2.简单修改menu及menu相关详解 ...

随机推荐

  1. Call to a member function assign() on a non-object;thinkphp中报错

    这个在自己写的类中 需要function __construct(){parent::__construct();}继承父类构造函数 当发生这个错误的时候,需要在构造函数中集成父类构造

  2. [TypeScript] Create random integers in a given range

    Learn how to create random integers using JavaScript / TypeScript. /** * Returns a random int betwee ...

  3. [GraphQL] Use GraphQLList with GraphQLObject Types

    When working with collections of things in GraphQL, we'll always reach out for the GraphQLListType. ...

  4. MySQL参数文件位置

    对于linux/unix: mysql --help|grep my.cnf   /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.m ...

  5. [Javascript] Format console.log with CSS and String Template Tags

    The Chrome console allows you to format messages using CSS properties. This lesson walks you through ...

  6. [Node.js] Build microservices in Node.js with micro

    micro is a small module that makes it easy to write high performance and asynchronous microservices ...

  7. ArcGIS网络概述

    转载自原文 ArcGIS网络概述 一.地理网络 (一)基本概念 由一系列相互连通的点和线组成,用来描述地理要素(资源)的流动情况. (二)网络类型 1.定向网络 (1)流向由源(source)至汇(s ...

  8. Android使用READ_CONTACTS读取手机联系人

    实例代码: package com.example.readcontacts; import java.io.InputStream; import java.util.ArrayList; impo ...

  9. Net程序调试

    Net程序调试 前言 作为一个.net开发工程师,不管是在写桌面程序.服务程序或web程序,在开发阶段,我们必须非常熟悉vs的动态调试技能,当然web程序可能还需要调试前端的脚本或样式,这不在本文的讨 ...

  10. [TFS4]TFS git地址,分支概念

    1)上传本地代码到TFS a.Generate Git Credentials,即创建git账户密码 b)上传本地代码 git add *git commit -m "纳入管理" ...