RelativeLayout系列:RelativeLayout还有gravity属性?

被下面这个代码惊讶到了,什么情况,RelativeLayout还有gravity属性?
在这里插入图片描述
看看源码,sdk\platforms\android-30\data\res\values\attrs.xml,还真有。。。
在这里插入图片描述
我们常用android:layout_centerHorizontal="true"layout_centerHorizontal这里面怎么没有?在RelativeLayout_Layout里面:

 <declare-styleable name="RelativeLayout_Layout">
        <!-- Positions the right edge of this view to the left of the given anchor view ID.
             Accommodates right margin of this view and left margin of anchor view. -->
        <attr name="layout_toLeftOf" format="reference" />
        <!-- Positions the left edge of this view to the right of the given anchor view ID.
            Accommodates left margin of this view and right margin of anchor view. -->
        <attr name="layout_toRightOf" format="reference" />
        <!-- Positions the bottom edge of this view above the given anchor view ID.
            Accommodates bottom margin of this view and top margin of anchor view. -->
        <attr name="layout_above" format="reference" />
        <!-- Positions the top edge of this view below the given anchor view ID.
            Accommodates top margin of this view and bottom margin of anchor view. -->
        <attr name="layout_below" format="reference" />
        <!-- Positions the baseline of this view on the baseline of the given anchor view ID. -->
        <attr name="layout_alignBaseline" format="reference" />
        <!-- Makes the left edge of this view match the left edge of the given anchor view ID.
            Accommodates left margin. -->
        <attr name="layout_alignLeft" format="reference" />
        <!-- Makes the top edge of this view match the top edge of the given anchor view ID.
            Accommodates top margin. -->
        <attr name="layout_alignTop" format="reference" />
        <!-- Makes the right edge of this view match the right edge of the given anchor view ID.
            Accommodates right margin. -->
        <attr name="layout_alignRight" format="reference" />
        <!-- Makes the bottom edge of this view match the bottom edge of the given anchor view ID.
            Accommodates bottom margin. -->
        <attr name="layout_alignBottom" format="reference" />
        <!-- If true, makes the left edge of this view match the left edge of the parent.
            Accommodates left margin. -->
        <attr name="layout_alignParentLeft" format="boolean" />
        <!-- If true, makes the top edge of this view match the top edge of the parent.
            Accommodates top margin. -->
        <attr name="layout_alignParentTop" format="boolean" />
        <!-- If true, makes the right edge of this view match the right edge of the parent.
            Accommodates right margin. -->
        <attr name="layout_alignParentRight" format="boolean" />
        <!-- If true, makes the bottom edge of this view match the bottom edge of the parent.
            Accommodates bottom margin. -->
        <attr name="layout_alignParentBottom" format="boolean" />
        <!-- If true, centers this child horizontally and vertically within its parent. -->
        <attr name="layout_centerInParent" format="boolean" />
        <!-- If true, centers this child horizontally within its parent. -->
        <attr name="layout_centerHorizontal" format="boolean" />
        <!-- If true, centers this child vertically within its parent. -->
        <attr name="layout_centerVertical" format="boolean" />
        <!-- If set to true, the parent will be used as the anchor when the anchor cannot be
             be found for layout_toLeftOf, layout_toRightOf, etc. -->
        <attr name="layout_alignWithParentIfMissing" format="boolean" />
        <!-- Positions the end edge of this view to the start of the given anchor view ID.
             Accommodates end margin of this view and start margin of anchor view. -->
        <attr name="layout_toStartOf" format="reference" />
        <!-- Positions the start edge of this view to the end of the given anchor view ID.
             Accommodates start margin of this view and end margin of anchor view. -->
        <attr name="layout_toEndOf" format="reference" />
        <!-- Makes the start edge of this view match the start edge of the given anchor view ID.
            Accommodates start margin. -->
        <attr name="layout_alignStart" format="reference" />
        <!-- Makes the end edge of this view match the end edge of the given anchor view ID.
            Accommodates end margin. -->
        <attr name="layout_alignEnd" format="reference" />
        <!-- If true, makes the start edge of this view match the start edge of the parent.
            Accommodates start margin. -->
        <attr name="layout_alignParentStart" format="boolean" />
        <!-- If true, makes the end edge of this view match the end edge of the parent.
            Accommodates end margin. -->
        <attr name="layout_alignParentEnd" format="boolean" />
    </declare-styleable>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值