scrollview怎模样可以在maxheight的时候自动占据剩余所有空间

scrollview怎样子可以在maxheight的时候自动占据剩余所有空间?
scrollview怎模样可以在maxheight的时候自动占据剩余所有空间

像这样上面画了斜杠的是textview,用来scrollview包裹起来了,我想当这个textview文本量少的时候,下面那条红色按钮跟随scrollview的wrapcontent大小自动跟在下面,而textview文本量大的时候,自动扩展高度直至占据屏幕所有剩余可用空间,像设置了weight=1一样,效果如下图,红色按钮始终显示在屏幕上,跟在scrollview下面。如果直接让textview的width设置wrapcontent,文本长的时候下面的红色按钮直接就被textview推出屏幕外面了,不知道如何实现,虚心求教!!

scrollview怎模样可以在maxheight的时候自动占据剩余所有空间
scrollbar

------解决方案--------------------
不知道我理解的有没有问题,就是button一直跟在scrollview下面,要是超出屏幕的时候scrollview出现滚动,button在最下面?

下面是我写的,自己填充textview个数测试高度。
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
     android:orientation="vertical"
    >
    
    <ScrollView 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="20dip"
        android:scrollbars="vertical"
        
        android:id="@+id/sc"
        android:layout_weight="5"
        >
        <LinearLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            
            >
            <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
            <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
            <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
            
          
            
            
        </LinearLayout>
    </ScrollView>
    <Button 
        android:layout_weight="0"
        android:text="确定"
        android:background="@android:color/darker_gray"
       
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
</LinearLayout>