【发布时间】:2013-05-15 23:08:50
【问题描述】:
我想对齐放置在两个不同RelativeLayouts 中的两个TextViews 的基线。以下是我正在使用的代码:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right">
<TextView
android:id="@+id/tv_city_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_city_b"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/tv_city"
android:background="@drawable/txt_field_white"/>
</RelativeLayout>
我想将tv_city_a 的基线与tv_city_b 对齐,但上面的代码不起作用。
注意:由于设计要求,我需要将TextView 放在两个不同的RelativeLayout 中。我不能把它们放在一起。
编辑以下是我得到的输出:
【问题讨论】:
-
你能发布你的输出或完整的布局
-
你可以将两个相对布局放在一些线性布局中
标签: android android-layout android-relativelayout textview