Search code examples
androidlistviewandroid-listviewscroller

Scroller does not show the rest of listView content


i used the bounceScroller lib from this link: https://github.com/coderkiss/BounceScroller

and my layout have this structure :

 <FrameLayout>
         <me.dawson.bounce.BounceScroller>
             <ListView>
             </ListView>
         </me.dawson.bounce.BounceScroller>
    </frameLayout>

i used the bounce scroller to set bounce to the listview like the default of ios (just marginig in the scrolling)

it is worked , but when i long press and move the bounce scroller stop the list view scrolling and show header and footer.

my layout code is :

  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
        android:layout_height="match_parent" tools:context="android.blaaaaaa.com.bla.Home_fra">

        <!-- TODO: Update blank fragment layout -->
        <me.dawson.bounce.BounceScroller xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/pc_root"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:background="@android:color/transparent" >
       <ListView

           android:scrollbars="none"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/main_list_view"
           android:paddingLeft="5dp"
           android:overScrollMode="never"
           android:listSelector="@android:color/transparent"
           android:paddingRight="5dp"
           android:paddingBottom="10dp"></ListView>

        </me.dawson.bounce.BounceScroller>
    </FrameLayout>

my class code :

   View rootView = inflater.inflate(R.layout.fragment_home_fra, container, false);

        final ListView Main_List_View = (ListView) rootView.findViewById(R.id.main_list_view);
        main_adapter = new Mian_list_adapter(getActivity() , 0 ,main_title , main_rest);
        Main_List_View.setAdapter(main_adapter);


        scroller = (BounceScroller) rootView.findViewById(R.id.pc_root);
        scroller.requestDisallowInterceptTouchEvent(true);
        scroller.setListener(bl).enableHeader(true).enableFooter(true); 

Solution

  • You cannot put a ListView inside a ScrollView and expect it to work correctly. The ListView has already native scroll, so putting in a ScrollView will mess it up.

    If you want to implement bouncy scrolling for ListViews, you should search other methods, like this lib.