ListView not expanding inside NestedScrollView

Bincy Baby picture Bincy Baby · Oct 1, 2015 · Viewed 44.8k times · Source

I am using CoordinatorLayout in my activity page. In that there is ListView below the app bar. But its not working when I use ListView instead of NestedScrollView. And if I put ListView inside NestedScrollView, ListView is not expanding

Answer

Chung Nguyen picture Chung Nguyen · Dec 7, 2015

you can fix it when you add addtribute android:fillViewport="true" in android.support.v4.widget.NestedScrollView :) . This my code.

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:fillViewport="true"
    >
    <ListView
        android:id="@+id/list_myContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"
        >
    </ListView>

</android.support.v4.widget.NestedScrollView>