Elie Daher
Elie Daher

Reputation: 390

ListView not scrolling inside of NestedScrollView

I am using a ListView inside of a NestedScrollView. The List expand to match the parent but there is no scrolling now

Here is my layout :

<android.support.v4.widget.NestedScrollView  
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:fillViewport="true"
>
       <LinearLayout
           android:orientation="vertical"
           android:layout_width="match_parent"
           android:layout_height="wrap_content">

            <ListView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:id="@+id/workExperienceListLV"
                android:divider="@null"
                android:listSelector="@android:color/transparent"
                android:dividerHeight="0dp"/>

        </LinearLayout>

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

This line did not help :

android:fillViewport="true"

Thanks for the help!

Upvotes: 3

Views: 4339

Answers (2)

Ashwin
Ashwin

Reputation: 118

Use ViewCompat.setNestedScrollingEnabled() and you should be fine.

Upvotes: 0

Vineeth S Thadathil
Vineeth S Thadathil

Reputation: 44

this is because of using a ListView inside a scrollview(NestedScrollView).becacuse both having scroll ,if you want to scroll this you just reduce the width of the listview to half of the screen. like this..

 <ListView
                android:layout_width="70dp"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:id="@+id/workExperienceListLV"
                android:divider="@null"
                android:listSelector="@android:color/transparent"
                android:dividerHeight="0dp"/>

Upvotes: -3

Related Questions