سؤال

I am using the old version of Android PullToRefresh library. It works fine for triggering loading when over scrolling.

However, I want to show the loading footer view when I first enter my activity. I tried many times but still cannot find a correct way.

Is there anybody could help me out?

هل كانت مفيدة؟

المحلول

try to set it to show footer with a delay of 300-500 millis,sometimes it doesn't have enough time to initialise

new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            mPullRefreshGridView.setRefreshing(true);
        }
    }, 500);

this solved the problem to me

نصائح أخرى

Set PullToRefreshListView mode:

<com.handmark.pulltorefresh.library.PullToRefreshListView
ptr:ptrMode="pullFromEnd"
ptr:ptrAnimationStyle="rotate"
/>

call

getRefreshableListView().setRefreshing();

where getRefreshableListView() is your method that finds actual PullToRefreshListView. After initial loading of your data don't forget to call

getRefreshableListView().onRefreshComplete();

if setRefreshing() does not work, try using postDelayed():

getRefreshableListView().postDelayed(new Runnable() { getRefreshableListView().setRefreshing();}, 200);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top