gpt4 book ai didi

android - 使用相对布局

转载 作者:太空狗 更新时间:2023-10-29 16:23:27 26 4
gpt4 key购买 nike

我想做这样的布局:

enter image description here

问题在于对齐 TextView:我希望它们都水平居中。我得到的唯一解决方案是在根 RelativeLayout 中使用嵌套的 LinearLayout。如何让 TextView 水平居中仅使用根 RelativeLayout,而不使用嵌套的 LinearLayout

最佳答案

假设 id 0f imageview 是图像。然后对于第一个 textView 你可以做这样的事情:

android:layout_alignLeft="@id/image"

对于第二个textView

android:layout_alignRight="@id/image"

您还可以在执行此操作后在两个 textViews 中留出一些边距

关于android - 使用相对布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8586002/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com