【发布时间】:2011-07-04 19:32:49
【问题描述】:
好的,首先,我搜索了所有互联网,但没有人有类似的问题。所以,我想要的只是有 3 个文本视图,底部与屏幕对齐并具有相同的宽度。这是代表我想要的图像:
这是我的代码:
<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>
好吧,当 3 个 textViews 具有相同的高度时它可以工作,但是当它们的大小不同时,我得到以下结果:
另一个奇怪的行为是,当我将最大文本的 layout_gravity 设置为“center-vertical”时,我得到以下结果:
显然,我发疯了并尝试了另一种与 center-vertical 的组合,但最初没有任何效果:
那么,有什么技巧可以解决这个问题吗?
【问题讨论】:
标签: android