android relativelayout 垂直居中,Android中RelativeLayout的字符水平(垂直居中)对齐

【背景】此处Android中显示出来的TextView中的内容,水平中间不对其。想要实现水平居中对齐。【折腾过程】1.搜:android RelativeLayout horizontal center参考:试过了:android:layout_centerHorizontal="true"但没用。2.后来看到:去试了试:android:layout_centerVertical="true"才明...
摘要由CSDN通过智能技术生成

【背景】

此处Android中显示出来的TextView中的内容,水平中间不对其。

想要实现水平居中对齐。

【折腾过程】

1.搜:

android RelativeLayout horizontal center

参考:

试过了:

android:layout_centerHorizontal="true"

但没用。

2.后来看到:

去试了试:

android:layout_centerVertical="true"

才明白:

我上面是错误的搜了horizontal ,实际上该去搜Vertical才对。

现在效果是所需要的了:

d1f0e70523dd5f70cee2e6e8af16d729.png

【总结】

想要水平居中对齐,则只需要去设置:

android:layout_centerVertical="true"

即可。

【引申】

更多的其他参数,可以去官网:

中找到:

Attribute Name

Related Method

Description

Positions the bottom edge of this view abo

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值