2011-05-26 88 views
5

我有简单的布局是这样的:(它是邮件)如何拉伸布局以填充屏幕?

<ScrollView android:layout_height="0dp" android:layout_width="fill_parent" android:layout_weight="1" android:background="@color/red_start"> 

     <LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" android:background="@color/blue_start"> 

      <TextView style="@style/MyTextViewLabel" android:text="From" android:layout_marginTop="5dp"/> 

      <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/shape_white_rounded"> 
       <TextView style="@style/MyTextViewLabel.Black" android:id="@+id/tv_sender" /> 
      </LinearLayout> 

      <TextView style="@style/MyTextViewLabel" android:text="Subject" android:layout_marginTop="5dp"/> 

      <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/shape_white_rounded"> 
       <TextView style="@style/MyTextViewLabel.Black" android:id="@+id/tv_subject" /> 
      </LinearLayout> 

      <TextView style="@style/MyTextViewLabel" android:text="Body" android:layout_marginTop="5dp"/> 

      <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/shape_white_rounded"> 
       <TextView style="@style/MyTextViewLabel.Black" android:id="@+id/tv_body" /> 
      </LinearLayout> 

     </LinearLayout> 

    </ScrollView> 

出于某种原因,如我所料的LinearLayout不会填满滚动型。基本上,我想让tv_body填充屏幕,如果有更多的文本 - 它应该是可滚动的。现在看起来像这样。我添加颜色以表明滚动型弹力但LinearLayout中不..

enter image description here

回答

0

如果您在滚动型改变android:layout_height="0dp"android:layout_height="match_parent"会发生什么?

+0

没有做出区别 – katit 2011-05-26 02:34:56