RelativeLayout.LayoutParams

RelativeLayout.LayoutParams通过id设置相对兄弟元素对齐。<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android&qu

大家好,又见面了,我是你们的朋友全栈君。

通过id设置相对兄弟元素对齐。

 <span role="heading" aria-level="2">RelativeLayout.LayoutParams

 

<span role="heading" aria-level="2">RelativeLayout.LayoutParams
<span role="heading" aria-level="2">RelativeLayout.LayoutParams

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/lyla_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:textSize="24sp" android:text="Lyla" /> <TextView android:id="@+id/me_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_toRightOf="@id/lyla_text_view" android:textSize="24sp" android:text="Me" /> <TextView android:id="@+id/natalie_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/lyla_text_view" android:textSize="24sp" android:text="Natalie" /> <TextView android:id="@+id/jennie_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:textSize="24sp" android:text="Jennie" /> <TextView android:id="@+id/omoju_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_above="@id/jennie_text_view" android:textSize="24sp" android:text="Omoju" /> <TextView android:id="@+id/amy_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_above="@id/omoju_text_view" android:layout_alignParentRight="true" android:textSize="24sp" android:text="Amy" /> <TextView android:id="@+id/ben_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:textSize="24sp" android:text="Ben" /> <TextView android:id="@+id/kunal_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/ben_text_view" android:textSize="24sp" android:text="Kunal" /> <TextView android:id="@+id/kagure_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_toRightOf="@id/ben_text_view" android:textSize="24sp" android:text="Kagure" /> </RelativeLayout>

相对兄弟节点(id)放置

 

 

XML属性

android:layout_above 将此视图的下边缘定位在给定锚点视图ID上方。 
android:layout_alignBaseline 将此视图的基线定位在给定锚点视图ID的基线上。 
android:layout_alignBottom 使此视图的下边缘与给定锚点视图ID的下边缘匹配。 
android:layout_alignEnd 使此视图的结束边缘与给定锚点视图ID的结束边缘匹配。 
android:layout_alignLeft 使此视图的左边缘与给定锚点视图ID的左边缘匹配。 
android:layout_alignParentBottom 如果为true,则使此视图的下边缘与父级的下边缘匹配。 
android:layout_alignParentEnd 如果为true,则使此视图的结束边缘与父级的结束边缘匹配。 
android:layout_alignParentLeft 如果为true,则使此视图的左边缘与父窗口的左边缘匹配。 
android:layout_alignParentRight 如果为true,则使此视图的右边缘与父级的右边缘匹配。 
android:layout_alignParentStart 如果为true,则使此视图的起始边缘与父级的起始边缘匹配。 
android:layout_alignParentTop 如果为true,则使此视图的上边缘与父级的上边缘匹配。 
android:layout_alignRight 使此视图的右边缘与给定锚点视图ID的右边缘匹配。 
android:layout_alignStart 使此视图的起始边缘与给定锚点视图ID的起始边缘匹配。 
android:layout_alignTop 使此视图的上边缘与给定锚点视图ID的上边缘匹配。 
android:layout_alignWithParentIfMissing 如果设置为true,则在无法找到layout_toLeftOf,layout_toRightOf等的锚点时,父项将用作锚点。 
android:layout_below 将此视图的上边缘定位在给定锚点视图ID下方。 
android:layout_centerHorizontal 如果为true,则将此子项水平居中于其父级。 
android:layout_centerInParent 如果为true,则将此子项在其父级中水平和垂直居中。 
android:layout_centerVertical 如果为true,则将此子项垂直居中于其父项中。 
android:layout_toEndOf 将此视图的起始边缘定位到给定锚点视图ID的末尾。 
android:layout_toLeftOf 将此视图的右边缘定位在给定锚点视图ID的左侧。 
android:layout_toRightOf 将此视图的左边缘定位到给定锚点视图ID的右侧。 
android:layout_toStartOf 将此视图的结束边缘定位到给定锚点视图ID的开头。 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/154769.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • adas毫米波雷达_雷达探测障碍物是超声波吗

    adas毫米波雷达_雷达探测障碍物是超声波吗ADAS超声波雷达在倒车入库,慢慢挪动车子的过程中,在驾驶室内能听到”滴滴滴“的声音,这些声音就是根据超声波雷达的检测距离给司机的反馈信息。倒车雷达系统,英文全称为REVERSING/PARKINGAIDSUBSYSTEM,BACKSENSOR或PACKINGSENSOR,英文简称RPA。目前被各种轿车特别是高级轿车作为汽车电装品的标准配置或售后的汽车电装品主是选配品,例如:德国…

  • c语言时间戳转换日期格式_c语言时间转换为时间戳

    c语言时间戳转换日期格式_c语言时间转换为时间戳时间戳是计算机中记录时间的一种方法,某一时刻的时间戳指的是从1970年1月1日0时0分0秒开始到该时刻总共过了多少秒。请编程任意输入一个整数,然后计算出它表示的是哪一天哪一刻。问题分析输入:任意整数n(0≤n≤2147483647),表示从1970年1月1日0时0分0秒到该时刻过了多少秒。输出:y年m月d日H时M分S秒,y、m…

  • Lambda表达式

    Lambda表达式

    2021年11月12日
  • qt qtreewidgetitem_qtwidgets

    qt qtreewidgetitem_qtwidgetsQTreeWidget在添加了数据之后点击扩展箭头展开和收缩的时候会显得卡顿,这个是qt内核的一个bug,正常情况下应该是立即响应的,既然是qt的bug,就只能换种方式实现TreeWidget来解决这个bug,具体办法大致可以有一下几种,具体看需求来决定用哪一种方法更好:如果需求要求实现的TreeWidget不要求是完全的TreeWidget,扩展的层次是有限制的,就是只有2层,3层或者…

  • 数据类型转换的类是Convert_c++类型转换

    数据类型转换的类是Convert_c++类型转换C#数据类型和类型转换Convert.ToInt16与Convert.ToInt32区别版权声明:本文由 群燕小站 原创,转载请注明【转自:群燕小站(http://www.zqunyan.com);原文链接: http://www.zqunyan.com/79.html】取值的范围不同:int16:-32768到32767 int32:-2,147,483,648到2…

  • Java集合篇:Stack

    Java集合篇:Stack

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号