2011-05-26 95 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