LinearLayout: layout_gravity=“bottom” not working on Horizontal LinearLayout

前端 未结 7 839
青春惊慌失措
青春惊慌失措 2020-12-02 09:07

Ok, First of all, I searched all the internet, but nobody has a similar problem like this. So, all I want is to have 3 textViews, bottom aligned with the screen and with the

相关标签:
7条回答
  • 2020-12-02 09:58

    Same as Timmm's answer, but you also can use android:gravity="bottom" for LinearLayout attribute instead of android:layout_gravity="bottom" for each of TextView.

    Like this:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:gravity="bottom"
          android:baselineAligned="false">
          <TextView 
               android:layout_width="0dp"
               android:layout_height="wrap_content"
               android:text="your text 1......"
               android:layout_weight="1"/>
    
          <TextView 
               android:layout_width="0dp"
               android:layout_height="wrap_content"
               android:text="your text 2......"
               android:layout_weight="1"/>
    
          <TextView 
               android:layout_width="0dp"
               android:layout_height="wrap_content"
               android:text="your text 3......"
               android:layout_weight="1"/>
    
    </LinearLayout>
    
    0 讨论(0)
提交回复
热议问题