首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Android开发学习笔记(六)相对布局RelativeLayout

Android开发学习笔记(六)相对布局RelativeLayout

作者头像
zstar
发布2022-06-14 10:08:40
发布2022-06-14 10:08:40
3210
举报
文章被收录于专栏:往期博文往期博文

案例效果:

源码:

代码语言:javascript
复制
<RelativeLayout android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"
    >

    <TextView
        android:id="@+id/labe1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="相对布局"
        android:textSize="50sp">

    </TextView>

    <EditText
        android:id="@+id/et1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/labe1">

    </EditText>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/et1"
        android:text="OK"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"></Button>
</RelativeLayout>

两个值true对齐,false不对齐 相对某个控件layout_toLeftOfs (例子中没写)

总结:相对布局比较简单,主要注意每个控件取个id名即可

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-02-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档