当前位置: 移动技术网 > IT编程>移动开发>Android > Xamarin.Forms 界面布局

Xamarin.Forms 界面布局

2019年09月24日  | 移动技术网IT编程  | 我要评论

赵登,玛卡亚米,张古江

 <!--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>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网