johannilsson / android-pulltorefresh

DEPRECATED This project aims to provide a reusable pull to refresh widget for Android.
2.47k stars 1.03k forks source link

Tap to refresh is shown when only two items in ListView #59

Open shadabhub opened 11 years ago

shadabhub commented 11 years ago

Tap to refresh is shown when only two items in ListView.

Can "Tap to refresh" can be hidden when listview content few items(2 or 3 items).?

lhhGit commented 11 years ago

This issue bothers me too.

vinceyuan commented 10 years ago

My walkaround is adding a big empty footer view into the list view. Note that you have to add the footer view before setting the list adapter.

danwebanddev commented 10 years ago

I get this issue too. @vinceyuan your workaround doesn't work for me, could you post the xml of your footer view, please?

vinceyuan commented 10 years ago

@danwebanddev The tricky thing is we must add an inner layout otherwise the customized height does not work.

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" >

<!--Must add an inner layout otherwise the customized height does not work--> 
<FrameLayout
    android:id="@+id/frameLayout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/footer_view_small_height" >
</FrameLayout>

vinceyuan commented 10 years ago

Correct code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<!--Must add an inner layout otherwise the customized height does not work--> 
<FrameLayout
    android:id="@+id/frameLayout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/footer_view_small_height" >
</FrameLayout>

</RelativeLayout>
danwebanddev commented 10 years ago

@vinceyuan Thank you very much, I will try!