相关疑难解决方法(0)

LinearLayout:layout_gravity ="bottom"不在Horizo​​ntal LinearLayout上工作

好的,首先,我搜索了所有的互联网,但没有人有类似的问题.所以,我想要的只有3个textViews,底部与屏幕对齐,宽度相同.这是一个代表我想要的图像:

在此输入图像描述

这是我的代码:

 <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>
Run Code Online (Sandbox Code Playgroud)

好吧,当3个textView具有相同的高度时,它可以工作,但是当它们的大小不同时,我得到以下结果:

问题

另一个奇怪的行为是,当我将最大文本的layout_gravity设置为"center-vertical"时,我得到以下结果:

第一个解决方法

显然,我疯了,尝试了另一种中心垂直组合,但最初没有任何效果:

绝望的解决方法

那么,有关如何解决这个问题的任何提示?

android

45
推荐指数
1
解决办法
5万
查看次数

标签 统计

android ×1