ScrollView fillVeewport

ScrollView裏只放一個元素.
  
  當ScrollView裏的元素想填滿ScrollView時,使用"fill_parent"是無論用的,必需爲ScrollView設置:android:fillViewport="true"。
  
   當ScrollView沒有fillVeewport=「true」時, 裏面的元素(好比LinearLayout)會按照wrap_content來計算(不論它是否設了"fill_parent"),而若是LinearLayout的元素設置了fill_parent,那麼也是無論用的,由於LinearLayout依賴裏面的元素,而裏面的元素又依賴LinearLayout,這樣自相矛盾.因此裏面元素設置了fill_parent,也會當作wrap_content來計算.
相關文章
相關標籤/搜索