Android Studio - 填充剩余的空白 space(身高?)

Android Studio - Fill remaining blank space (with height?)

我有这个:Application

我想抓取浅蓝色的文字(code) and make it so it automatically fills the blank space if there is any, like so: example(可以是空白文字)

要调整大小的文本代码(第二个 TextView,除非你可以调整布局):

    <!-- Info -->
    <LinearLayout
        android:id="@+id/personalAppLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/backgroundColor">

        <TextView
            android:id="@+id/descriptionTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/homepage_title"
            android:textAlignment="center"
            android:textStyle="bold"
            android:layout_marginTop="@dimen/activity_vertical_margin"/>

        <TextView
            android:id="@+id/description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/homepage_description"
            android:textAlignment="center"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_marginEnd="@dimen/activity_horizontal_margin"
            android:layout_marginTop="@dimen/activity_vertical_margin"
            android:layout_marginBottom="@dimen/activity_vertical_margin"/>

    </LinearLayout>

    <!-- Greyish Line -->
    <View
        android:layout_width="match_parent"
        android:layout_height="0.1dp"
        android:background="@color/backgroundColorDark" />

这是图像的代码:Images

    <!-- Info -->
    <LinearLayout
        android:id="@+id/personalAppLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/backgroundColor">

        <TextView
            android:id="@+id/descriptionTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/homepage_title"
            android:textAlignment="center"
            android:textStyle="bold"
            android:layout_marginTop="@dimen/activity_vertical_margin"/>

        <TextView
            android:id="@+id/description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/homepage_description"
            android:textAlignment="center"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_marginEnd="@dimen/activity_horizontal_margin"
            android:layout_marginTop="@dimen/activity_vertical_margin"
            android:layout_marginBottom="@dimen/activity_vertical_margin"/>

    </LinearLayout>

底部导航代码:Bottom Navigation

    <!-- Bottom Navigation -->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.design.widget.BottomNavigationView
            android:id="@+id/navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="0dp"
            android:layout_marginStart="0dp"
            android:background="?android:attr/windowBackground"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:menu="@menu/navigation"
            android:layout_alignParentBottom="true"/>

    </RelativeLayout>

一切都在垂直方向的 LinearLayout 中,在这些布局之前还有更多布局,但我相信这些才是最重要的。

是否可以在手机上自动填空 space 而无需指定 dp 的数量?

Code as a whole (I intend to auto size the first LinearLayout until all remaining blank space is filled, without overlaping any of the other layouts)

编辑:现在已更改为完整的工作代码,感谢 Rockney

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">


<!-- Info -->
<LinearLayout
    android:id="@+id/personalAppLayout"
    android:layout_width="match_parent"
    <!-- Previously android:layout_height="wrap_content" and without a weight -->
    android:layout_height="0dp"
    android:weight="1"
    android:orientation="vertical"
    android:background="@color/backgroundColor">

    <TextView
        android:id="@+id/descriptionTitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/homepage_title"
        android:textAlignment="center"
        android:textStyle="bold"
        android:layout_marginTop="@dimen/activity_vertical_margin"/>

    <TextView
        android:id="@+id/description"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/homepage_description"
        android:textAlignment="center"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:layout_marginEnd="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_marginBottom="@dimen/activity_vertical_margin"/>

</LinearLayout>

<!-- Greyish Line -->
<View
    android:layout_width="match_parent"
    android:layout_height="0.1dp"
    android:background="@color/backgroundColorDark" />

<!-- Social Media -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="70dp"
    android:orientation="horizontal"
    android:background="@color/backgroundColor"
    android:gravity="center" >

    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:background="@drawable/linkedin_logo" />

    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:background="@drawable/facebook_logo" />

    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:background="@drawable/twitter_logo" />

</LinearLayout>

<!-- Greyish Line -->
<View
    android:layout_width="match_parent"
    android:layout_height="0.1dp"
    android:background="@color/backgroundColorDark" />

<!-- Bottom Navigation -->
<RelativeLayout
    android:layout_width="match_parent"
    <!-- Previously android:layout_height="match_parent" -->
    android:layout_height="60dp" >

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="0dp"
        android:layout_marginStart="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/navigation"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>

</LinearLayout>

您可以使用布局粗细。它指定视图中有多少额外的 space。 you can read more about in this Whosebug post.您确实需要将布局更改为此。

<LinearLayout
android:id="@+id/personalAppLayout"
android:layout_width="match_parent"
android:layout_height="0dp”
android:orientation="vertical"
android:layout_weight=“1”
android:background="@color/backgroundColor">

<TextView
    android:id="@+id/descriptionTitle"
    android:layout_width="match_parent"
    android:layout_weight=“1”
    android:layout_height="0dp"
    android:text="@string/homepage_title"
    android:textAlignment="center"
    android:textStyle="bold"
    android:layout_marginTop="@dimen/activity_vertical_margin"/>

<TextView
    android:id="@+id/description"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/homepage_description"
    android:textAlignment="center"
    android:layout_marginStart="@dimen/activity_horizontal_margin"
    android:layout_marginEnd="@dimen/activity_horizontal_margin"
    android:layout_marginTop="@dimen/activity_vertical_margin"
    android:layout_marginBottom="@dimen/activity_vertical_margin"/>

 </LinearLayout>