首先,我已经在整个互联网上搜索了一遍,但是没有人有类似的问题。所以,我想要的只是拥有3个textView,底部对齐屏幕,并且宽度相同。下面是一个代表我的需求的图像:
这是我的代码:
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:text="@string/help_1"
android:layout_weight="0.33"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/mynicebg1"
android:layout_gravity="bottom"/>
<TextView
android:text="@string/help_2"
android:layout_weight="0.33"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/mynicebg2"
android:layout_gravity="bottom"/>
<TextView
android:text="@string/help_3"
android:layout_weight="0.33"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/mynicebg3"
android:layout_gravity="bottom"/>
</LinearLayout>
</RelativeLayout>
当三个textView的高度相同时,它是有效的,但当它们的大小不同时,会得到以下结果:
另一个奇怪的行为是,当我将最大文本的layout_gravity设置为"center-vertical"时,我会得到以下结果:
显然,我变得疯狂并尝试了其他与center-vertical的组合,但没有像最初想的那样工作:
那么,有什么解决方法吗?
LinearLayout
的代码,了解它如何使用baselineAligned
,并检查您的代码是否覆盖了其方法。您使用的是baselineAligned
而不是baseAligned
,对吧? - Timmmm