1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > android 垂直水平居中对齐 Android中RelativeLayout的字符水平(垂直居中)对齐

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

时间:2020-11-07 19:43:19

相关推荐

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

【背景】

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

想要实现水平居中对齐。

【折腾过程】

1.搜:

android RelativeLayout horizontal center

参考:

试过了:

android:layout_centerHorizontal="true"

但没用。

2.后来看到:

去试了试:

android:layout_centerVertical="true"

才明白:

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

现在效果是所需要的了:

【总结】

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

android:layout_centerVertical="true"

即可。

【引申】

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

中找到:

Attribute Name

Related Method

Description

Positions the bottom edge of this view ab

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。