zoukankan      html  css  js  c++  java
  • Xamarin.Forms 界面布局

     <!--margin表示控件相对StackLayout的位置是设置组件之间的距离,或者距离父组件边缘的距离,
        他的四个值是左边距,上边距,右边距,下边距  -->
        <!--Padding是设置组件内容与组件边缘的距离,他的四个值是左边距,上边距,右边距,下边距-->
        <!--本实例中如果Margin和Padding在同一层级都是stackLayout的话表现结果应该都是一样的-->
        <!--Orientation 有俩个属性 Horizontal:横向排列,Vertical:竖向排列默认竖向 -->
        <!--HorizontalOptions: 浮动填充的概念,Start左浮动,Center中间浮动,End右浮动.这4个属性控件大小根据内容自动,,
        StartAndExpand 向上填充一行,CenterAndExpand 向中间位置填充一行,EndAndExpand 向下位置填充一行,FillAndExpand 填充全部 -->
        <!--WidthRequest对填充一行的设置无效,HeightRequest对FillAndExpand无效 -->
        <StackLayout Margin="30,35,10,30"  Spacing="20" Orientation="Vertical" >
            <!-- Place new controls here -->
            <!--HorizontalOptions:-->
            <Label Text="开始位置"
               HorizontalOptions="Start"
               BackgroundColor="LightGray" WidthRequest="30" HeightRequest="100" />
            <Label Text="中间"
               HorizontalOptions="Center"
               BackgroundColor="LightGray" />
            <Label Text="结束位置,终点位置"
               HorizontalOptions="End"
               BackgroundColor="LightGray" />
            <Label Text="一行填充完整"
               HorizontalOptions="Fill"
               BackgroundColor="LightGray" HeightRequest="100" WidthRequest="30" />
            <Label Text="StartAndExpand"
               VerticalOptions="StartAndExpand"
               BackgroundColor="LightGray" />
            <Label Text="CenterAndExpand"
               VerticalOptions="CenterAndExpand"
               BackgroundColor="LightGray" />
            <Label Text="EndAndExpand"
               VerticalOptions="EndAndExpand"
               BackgroundColor="LightGray" WidthRequest="30" HeightRequest="100" />
            <Label Text="FillAndExpand"
               VerticalOptions="FillAndExpand"
               BackgroundColor="LightGray" WidthRequest="30" />
        </StackLayout>

  • 相关阅读:
    收藏的网站
    记录
    在我的收藏列表里取消收藏功能的实现(不使用直接操作dom的方法)
    uniapp预览图片
    uni-app 中如何打开外部应用,如:浏览器、淘宝、AppStore、QQ等
    uniapp打包上架ios
    uniapp实现倒计时
    uniapp实现支付功能
    uniapp关闭页面回弹效果
    uniapp中使用websocket实现实时聊天功能
  • 原文地址:https://www.cnblogs.com/wxpMamarinFrom/p/11578275.html
Copyright © 2011-2022 走看看