Android 如何制作布局以填充空间,直到底部出现另一个布局

Android 如何制作布局以填充空间,直到底部出现另一个布局,android,android-layout,layout,Android,Android Layout,Layout,营养: “----”表示布局区域 <--------------------> <----<TextView_1>----> <--------------------> <-<..<TextView_a...>-> <-<... ...>-> <-<... ...>-> <-<... >...>

营养:

“----”表示布局区域

<-------------------->
<----<TextView_1>---->
<-------------------->
<-<..<TextView_a...>-> 
<-<...          ...>->
<-<...          ...>->
<-<...         >...>->
<-<................>->
<-<................>->
<-<................>->
<-<..*layout_end*..>->
<-------------------->
<----<TextView_2----->
<-----         >----->
<-------------------->
“…”表示另一个布局区域

<-------------------->
<----<TextView_1>---->
<-------------------->
<-<..<TextView_a...>-> 
<-<...          ...>->
<-<...          ...>->
<-<...         >...>->
<-<................>->
<-<................>->
<-<................>->
<-<..*layout_end*..>->
<-------------------->
<----<TextView_2----->
<-----         >----->
<-------------------->

“…”版面的内容只是TextView\u a,直到*版面结束*才足以填充

如果我在“…”布局中放置匹配\u父项,则文本视图\u 2不会出现。像这样:

<-------------------->
<----<TextView_1>---->
<-------------------->
<-<..<TextView_a...>-> 
<-<...          ...>->
<-<...          ...>->
<-<...        />...>->
<-<................>->
<-<................>->
<-<................>->
<-<................>->
<-<................>->
<-<................>->
<-<................>->
<-<..*layout_end*..>->

我需要“…”布局填充空间,但只为文本视图2留出空间。 我能做些什么来获得最高的成绩?这一结果:

<-------------------->
<----<TextView_1>---->
<-------------------->
<-<..<TextView_a...>-> 
<-<...          ...>->
<-<...          ...>->
<-<...         >...>->
<-<................>->
<-<................>->
<-<................>->
<-<..*layout_end*..>->
<-------------------->
<----<TextView_2----->
<-----         >----->
<-------------------->

对:
错误:

将按钮替换为您想要的任何按钮。甚至布局

<Button
    android:id="@+id/topbutton"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentTop="true" >

</Button>

<Button
    android:id="@+id/bottombutton"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentBottom="true" >

</Button>

<Button
    android:id="@+id/middlebutton"
    android:layout_width="40dp"
    android:layout_height="wrap_content"
    android:layout_above="@id/bottombutton"
    android:layout_below="@id/topbutton" >

</Button>



尝试放置另一个布局,然后将TextView2放入该布局中。然后,当您将match_parent属性应用于布局1的高度时,它将一直匹配到布局2。

创建一个垂直线性布局,如下所示:

<LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="mtch_parent"> 

     <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="48dip"/>        

     <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="0dip" android:layout_weight="1">

         <!-- put your TextView here -->
     </LinearLayout>


     <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="48dip"/> 
</LinearLayout>

我想说一句话,建议你做一个活动,第一个文本视图是页眉,第二个包含正文,第三个是页脚。在这种情况下,wrap\u content和match\u parent是您的朋友

<LinearLayout 
 android:orientation="vertical" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent">
<TextView
    android:id="@+id/top"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:padding_top="15dp"
    android:padding_bottom="15dp">
<TextView
    android:id="@+id/middle"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:padding_top="5dp"
    android:padding_bottom="5dp">
<TextView
    android:id="@+id/bottom"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:padding_top="15dp"
    android:padding_bottom="15dp">
</LinearLayout>


顶部和底部的高度通过填充进行调整,而中间的填充填充空间。

您可以链接一些图像吗?