Android 在textview中添加滚动条和虚拟文本会使其下方的布局消失

Android 在textview中添加滚动条和虚拟文本会使其下方的布局消失,android,android-layout,Android,Android Layout,我在我的文本视图中添加了滚动条和一些dumy文本,这是成功的。但是通过这样做,文本视图下的布局消失了。我希望我可以添加尽可能多的文本,而不必分发布局。 添加滚动条之前的XML预览屏幕截图: 添加滚动条和一些额外的虚拟文本后的屏幕截图: 这是我的XML代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android

我在我的文本视图中添加了滚动条和一些dumy文本,这是成功的。但是通过这样做,文本视图下的布局消失了。我希望我可以添加尽可能多的文本,而不必分发布局。 添加滚动条之前的XML预览屏幕截图:

添加滚动条和一些额外的虚拟文本后的屏幕截图:

这是我的XML代码:

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/empty"
    android:orientation="vertical"
    android:weightSum="3"
    tools:context=".story_activity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="Story Name"
        android:textAlignment="center"
        android:textColor="#fff"
        android:textSize="20sp"
        android:textStyle="bold" />
    <!-- android:layout_marginLeft="140dp"-->/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="15dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp"
        android:layout_weight="3"
        android:alpha="0.8"
        android:background="@drawable/story_des"
        android:orientation="vertical"
        android:weightSum="3">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:orientation="vertical">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:src="@drawable/lion" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1.2"
            android:orientation="vertical"
            android:weightSum="0.2">

            <TextView
                android:id="@+id/story_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:scrollbars="vertical"
                android:text="This specification does not indicate the behavior, rendering or otherwise, of space characters other than those explicitly identified here as white space characters. For this reason, authors should use appropriate elements and styles to achieve visual formatting effects that involve white space, rather than space characters.This specification does not indicate the behavior, rendering or otherwise, of space characters other than those explicitly identified here as white space characters. For this reason, authors should use appropriate elements and styles to achieve visual formatting effects that involve white space, rather than space characters.This specification does not indicate the behavior, rendering or otherwise, of space characters other than those explicitly identified here as white space characters. For this reason, authors should use appropriate elements and styles to achieve visual formatting effects that involve white space, rather than space characters."
                android:textColor="#fff"
                android:textSize="15sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="-10dp"
                android:layout_weight="0.3"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/story_rate"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="5dp"
                    android:padding="5dp"
                    android:text="Rate This Story"
                    android:textColor="#1e5aaa"
                    android:textSize="15sp"
                    android:textStyle="bold" />

                <ImageView
                    android:id="@+id/rate"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="center"
                    android:layout_toRightOf="@+id/story_rate"
                    android:src="@drawable/star" />

                <ImageView
                    android:id="@+id/rate1"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="center"
                    android:layout_toRightOf="@+id/rate"
                    android:src="@drawable/star" />

                <ImageView
                    android:id="@+id/rate2"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="center"
                    android:layout_toRightOf="@+id/rate1"
                    android:src="@drawable/star" />

                <ImageView
                    android:id="@+id/rate3"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="center"
                    android:layout_toRightOf="@+id/rate2"
                    android:src="@drawable/star" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.7"
            android:orientation="vertical">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:src="@drawable/line" />

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp">

                <ImageView
                    android:id="@+id/author_image"
                    android:layout_width="80dp"
                    android:layout_height="60dp"
                    android:layout_marginBottom="20dp"
                    android:layout_marginLeft="20dp"
                    android:src="@drawable/as" />

                <TextView
                    android:id="@+id/author_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="2dp"
                    android:layout_toRightOf="@+id/author_image"
                    android:fontFamily="century-gothic"
                    android:text="Author Title"
                    android:textColor="#fff"
                    android:textSize="15dp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/pub_content"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/author_title"
                    android:layout_marginLeft="2dp"
                    android:layout_marginTop="3dp"
                    android:layout_toRightOf="@+id/author_image"
                    android:fontFamily="century-gothic"
                    android:text="Pve sentences, cjajsxa "
                    android:textColor="#fff"
                    android:textSize="15dp"
                    android:textStyle="bold" />

            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

/>

在这一部分中考虑将其改为相对布局。为rate dialog part(带有该代码的线性布局)提供固定高度/包裹内容,然后将其设置为与底部匹配。将其与父项底部对齐

对于文本视图,将其约束设置为“将父对象顶部对齐”和“将底部对齐到速率对话框的开头”


这应该能奏效

为了让你说得对,你不希望这个故事部分的观点被推到下面,对吧?是的。这就是我要问的。
 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1.2"
        android:orientation="vertical"
        android:weightSum="0.2">