Android學習——解決NestedScrollView 佈局不能撐滿屏幕的問題

發現使用  NestedScrollView   嵌套使其佈局超出屏幕時滑動; 想讓最後一個子佈局位於屏幕最底方;

各種方法都不行,後來發現NestedScrollView 的 子佈局不能撐滿整個屏幕,而是包裹內容,按照wrap_content來計算,哪怕寫的 match_parent 也沒用;

解決辦法:

添加屬性:

android:fillViewport="true"  
 <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:overScrollMode="never">
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
 
            .....
 
        </LinearLayout>
</android.support.v4.widget.NestedScrollView>
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章