Xamarin

Xamarin布局

2017-11-18  本文已影响16人  落地成佛

一、概述

包含如下布局:
1、StackLayout
2、AbsoluteLayout
3、RelativeLayout
4、GridLayout
5、ScrollView

二、详细介绍

2.1 StackLayout

垂直或水平自动按顺序排列控件

2.2 AbsoluteLayout

通过以绝对值或比率设置坐标和大小来排列视图。


image.png

2.3 RelativeLayout

相对布局,可以相对与父容器(RelativeToParent)或者控件(RelativeToView)两种


image.png

2.4 GridLayout

将视图排列成网格
作用于:在网格中排列按钮/选项
排列视图,使其在一个维度上具有相同的大小(如在某些工具栏中)


image.png

2.5 ScrollView

有滚动条的布局


image.png

2.6其他扩展知识

  ScreenOrientation = ScreenOrientation.Landscape 手机横向
  ScreenOrientation = ScreenOrientation.Portrait 手机纵向
namespace MyRotatingApp.Droid
{
    [Activity (Label = "MyRotatingApp.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
    ScreenOrientation = ScreenOrientation.Landscape)] //This is what controls orientation
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
    {
        protected override void OnCreate (Bundle bundle)
上一篇 下一篇

猜你喜欢

热点阅读