smali
smali

Reputation: 4805

Disable default SwipeRefreshLayout animation on refresh

I am using swiperefreshlayout for pulltorefresh. when user pulls down it shows loading animation without calling setRefreshing(true).

I want to show loading animation only when setRefreshing(true) is called.

Is there any way to disable auto showing animation on pull of screen.

Thanks.

Upvotes: 2

Views: 2547

Answers (2)

Amit Vaghela
Amit Vaghela

Reputation: 22945

In your onCreate() method : Try doing these

mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                        mSwipeRefreshLayout.setRefreshing(false);
                        mSwipeRefreshLayout.setEnabled(false);

            }
        });

When you want to re do refresh than use vice-versa.

hope this helps.

Upvotes: 1

JAAD
JAAD

Reputation: 12379

Try this:

mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                        mSwipeRefreshLayout.setRefreshing(false);
            }
        });

Upvotes: 1

Related Questions