首页 头条 财经 产业 金融 电商 跨境 物流 会展 English
首页 / 国际电商 / 正文

控制控件到边框的距离做好页面布局layout_margintop

来源:
编辑:电经淘讯
时间:2025-01-27

layout_marginTop,layout_marginBottom,layout_marginRight,layout_marginLeft是 RelativeLayout 中的四种属性。


layout_marginTop 指定该属性所在控件距上部最近控件的最小值;
layout_marginBottom 指定该属性所在控件距下部最近控件的最小值;
layout_marginLeft 指定该属性所在控件距左边最近控件的最小值;
layout_marginRight 指定该属性所在控件距右边最近控件的最小值。
layout_marginTop使用方法:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
    <Button android:id="@+id/project"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="项目"
        android:layout_marginTop="50dp"/>
</RelativeLayout>

电经快报更多
经济视界更多

2025亚洲蜂联蜂产品与蜜蜂医疗会议圆满

2025年10月22日,2025亚洲蜂联蜂产品与蜜蜂医疗会议在江苏盱眙隆...[详细]

2025第25届江苏南京国际纺织服装供应链

   12 月第 25 届江苏南京国际纺织服装供应链博览...[详细]

热点财经更多
  • CopyRight @ 2013-2025 Reserved CN电商经济网版权所有所涉内容免责声明查阅