I have this LinearLayout and in it is a Map Fragment and this all works but I cannot get the linear layout to align to the bottom of the screen for some reason. Here is my xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:baselineAligned="false"
android:weightSum="1"
android:background="@mipmap/background_colour">
<LinearLayout
android:orientation="vertical"
android:layout_width="30dp"
android:layout_height="31dp"
android:weightSum="1"
android:id="@+id/back_button"
android:background="@drawable/navigation_back"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp">
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.31">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView7" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.30">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView6" />
</LinearLayout>
<LinearLayout
android:id="@+id/lay"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_weight="3.5">
</LinearLayout>
</LinearLayout>
The LinearLayout I am trying to align is the id: "lay" one.
I found a fix:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:baselineAligned="false"
android:weightSum="1"
android:background="@mipmap/background_colour">
<LinearLayout
android:orientation="vertical"
android:layout_width="30dp"
android:layout_height="31dp"
android:weightSum="1"
android:id="@+id/back_button"
android:background="@drawable/navigation_back"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp">
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="177dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView7" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="146dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView6" />
</LinearLayout>
<LinearLayout
android:id="@+id/lay"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.