Expiredmind
Expiredmind

Reputation: 808

Make SwipeRefreshLayout animation invisible

If its possible make Swipe refresh layout animation fully invisible? I want to make whole animation (including loading and cricle with arrow when pulling down gesture) dissapear but I want to be able to use the onRefresh function. Maybe you know any alternatives that I can use in my listview (OnScroll change listener and OverScroll doesnt work for me accroding to trigger the bottom overscoll in my listview and I don wont to trigger my function when the list is swipe up and relase to scroll itself up - the Swipe refresh layout handle it very well for me)

 protected void onCreate(Bundle savedInstanceState) {
       swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
                swipeRefreshLayout.setOnRefreshListener(NewActivity.this);
               swipeRefreshLayout.setEnabled(false);
                swipeRefreshLayout.setRefreshing(false);
    }

    @Override
    public void onRefresh() {
        Log.i(TAG, "refresh");
    }

Update: According to yours hints I tried to implemented in several ways ( using only setEnabled(false) or setRefreshing(false) or both but in that case the onRefresh function didnt trigger at all.

Upvotes: 1

Views: 1555

Answers (1)

Chirag.T
Chirag.T

Reputation: 756

Use ..

Edited From the documentation:

If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view. So to show the animation:

swiprefreshLayout.setEnabled( true );
swiperefreshLayout.setRefreshing( true );

And to hide the animation:

swiperefreshLayout.setRefreshing( false );
swiprefreshLayout.setEnabled( false );

Upvotes: 1

Related Questions