2015年4月27日 星期一

【Android UI】使用ScrollView屬性fillViewport解決全螢幕問題



ScrollView 留白的問題,可以在ScrollView中的android:fillViewport屬性設置為true。

當ScrollView裡的元素想填滿ScrollView時,使用"fill_parent"是沒用的,必需為ScrollView設置:android:fillViewport="true"

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="top"
    android:fillViewport="true"
    android:scrollbars="vertical">
</ScrollView>


沒有留言:

張貼留言