如何将右侧的textview设置为与底部的textview齐平

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/numberCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NumberCard"
style="@style/TextNameTitle"
android:layout_marginStart="@dimen/marginLarge"
android:layout_marginTop="@dimen/marginLarge"/>
<TextView
android:id="@+id/nameCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NameCard"
style="@style/TextNameBody"
android:layout_marginStart="@dimen/marginLarge"
android:layout_marginBottom="@dimen/marginLarge"
android:layout_below="@id/numberCard"/>
<TextView
android:id="@+id/totalCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TotalCard"
style="@style/TextNameTitle"
android:layout_marginEnd="@dimen/marginLarge"
android:layout_marginTop="@dimen/marginLarge"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
写属性:
也许也是这样(如果 text2 的高度小于 text1 ):
并键入
gravity="center"并margin证明文本的合理性。这是我使用约束布局解决问题的方法:
希望这有帮助:)
PS 谷歌推荐使用约束布局