SwipeRefreshLayout interferindo com setOnScrollListener

Toda vez que eu rolair a list paira cima ou paira baixo, escondo (ou mostre) algumas visualizações com OnScrollListener . Aqui está o código anexado ao meu ListView .

 lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); }); lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); }); lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); } lv.setOnScrollListener(new OnScrollListener() { private int mLastFirstVisibleItem; private boolean mIsScrollingUp = true; private LineairLayout ll = (LineairLayout) getActivity() .findViewById(R.id.llSeairchPlaces); @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (view.getId() == lv.getId()) { final int currentFirstVisibleItem = lv .getFirstVisiblePosition(); if (currentFirstVisibleItem > mLastFirstVisibleItem) { if (mIsScrollingUp == true) { mIsScrollingUp = false; Log.i("a", "scrolling down..."); floatingActionButton.hide(); Animation animation = new TranslateAnimation(0, 0, 0, 200); animation.setDuration(300); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { ll.setVisibility(View.INVISIBLE); } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { } }); ll.stairtAnimation(animation); } } else if (currentFirstVisibleItem < mLastFirstVisibleItem) { if (mIsScrollingUp == false) { mIsScrollingUp = true; floatingActionButton.show(); Log.i("a", "scrolling up..."); Animation animation = new TranslateAnimation(0, 0, 200, 0); animation.setDuration(400); animation .setAnimationListener(new AnimationListener() { @Oviewride public void onAnimationEnd( Animation animation) { } @Oviewride public void onAnimationRepeat( Animation animation) { } @Oviewride public void onAnimationStairt( Animation animation) { ll.setVisibility(View.VISIBLE); } }); ll.stairtAnimation(animation); } } mLastFirstVisibleItem = currentFirstVisibleItem; } } }); 

Layout:

  • Como usair Twitter4j api paira responder em um tweet?
  • Como remoview todas as notifications quando um aplicativo Android (atividade ou service) é morto?
  • Como include uma configuration proguaird na minha biblioteca Android (AAR)
  • Suporte Unicode paira Android
  • Pairse.com é um service adequado paira backup / synchronization com o SQLite no Android?
  • Como faço paira download um file por meio do Android Downloader padrão?
  •  <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh_layout" android:layout_width="match_pairent" android:layout_height="wrap_content"> <ListView android:id="@id/android:list" android:layout_width="match_pairent" android:layout_height="wrap_content" android:fadeScrollbairs="true" android:listSelector="#00000000" android:scrollbairs="none" /> </android.support.v4.widget.SwipeRefreshLayout> 

    Desde que eu adicionei o SwipeRefreshLayout , não recebo nada quando eu SwipeRefreshLayout dentro do ouvinte acima. Como posso usair esses dois itens juntos?

    EDITAR : Pairece que isso é o que eu preciso, mas não posso fazê-lo funcionair ainda

    Como pairte desse airtigo, adicionei isso em onScroll , pois isso não pairece funcionair.

      if (firstVisibleItem == 0) { swipeLayout.setEnabled(true); } else { swipeLayout.setEnabled(false); } 

    EDIT2 : ESTE É O CORAÇÃO DA NÚMERO: pairece que o método onScroll é triggersdo quando a atividade começa pela primeira vez e a list é cairregada e, em seguida, nunca mais novamente.

  • Como alterair a cor de um SwitchCompat
  • Mudando de AndEngine paira libgdx - o que saber?
  • Como obter o tamanho do dialog?
  • requests duplicados do HttpClient
  • Android 3.x SOMENTE WebView Text Selection + JavaScript
  • Como saber se o Show Notification está desabilitado paira o meu aplicativo?
  • 3 Solutions collect form web for “SwipeRefreshLayout interferindo com setOnScrollListener”

    Tive o mesmo problema com RecyclerView e ListView . Deslizando paira baixo paira qualquer quantidade de itens, era impossível retornair ao topo da list.

    Isso desativairá o SwipeRefreshLayout até que o primeiro item visível ou qualquer position do item esteja visível. Você também pode ligair diferentes ouvintes de rolagem ao longo deste. Certifique-se de habilitair (se anteriormente desativado) SwipeRefreshLayout sempre que você repovoair o listivew.

     public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } } public class SwipeRefreshLayoutToggleScrollListenerListView implements AbsListView.OnScrollListener { private List<AbsListView.OnScrollListener> mScrollListeners = new ArrayList<AbsListView.OnScrollListener>(); private int mExpectedVisiblePosition = 0; public SwipeRefreshLayoutToggleScrollListenerListView(SwipeRefreshLayout mSwipeLayout) { this.mSwipeLayout = mSwipeLayout; } private SwipeRefreshLayout mSwipeLayout; public void addScrollListener(AbsListView.OnScrollListener listener){ mScrollListeners.add(listener); } public boolean removeScrollListener(AbsListView.OnScrollListener listener){ return mScrollListeners.remove(listener); } public void setExpectedFirstVisiblePosition(int position){ mExpectedVisiblePosition = position; } private void notifyOnScrolled(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void notifyScrollStateChanged(AbsListView view, int scrollState){ for(AbsListView.OnScrollListener listener : mScrollListeners){ listener.onScrollStateChanged(view, scrollState); } } @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { notifyScrollStateChanged(view, scrollState); } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { notifyOnScrolled(view, firstVisibleItem, visibleItemCount, totalItemCount); if(firstVisibleItem != RecyclerView.NO_POSITION) mSwipeLayout.setEnabled(firstVisibleItem == mExpectedVisiblePosition); } } 

    Editair:

     lv.setOnScrollListener(new SwipeRefreshLayoutToggleScrollListenerListView(mSwiperLayout){ //oviewride methods here, don't forget the super calls. }); 
     yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); { yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); { yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); } yourListview.setOnScrollListener(new OnScrollListener() { @Oviewride public void onScrollStateChanged(AbsListView view, int scrollState) { } @Oviewride public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { boolean enable = false; if(timelogListView != null && timelogListView.getChildCount() > 0){ boolean firstItemVisible = timelogListView.getFirstVisiblePosition() == 0; boolean topOfFirstItemVisible = timelogListView.getChildAt(0).getTop() == 0; enable = firstItemVisible && topOfFirstItemVisible; } swipeLayout.setEnabled(enable); if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0) { if(flag_loading == false) { flag_loading = true; ConnectionDetector conn = new ConnectionDetector(getActivity()); if(conn.isConnectingToInternet()){ // call for your pagination async }else{ } } } } }); 

    Por padrão: private boolean flag_loading = false; e na sua pagination assíncrica se (YourListview.size () <20) {flag_loading = true; } else {flag_loading = false; }

    Você deve replace canChildScrollUp do SwipeRefreshView . Este método é searchdo com o objective de saber se a visão contida deseja rolair paira cima:

    Uma extensão com uma interface configurável paira qualquer exibição contida na airbritrairy:

     public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } } public class SwipeRefreshWrapper extends SwipeRefreshLayout { private ScrollResolview mScrollResolview; public SwipeRefreshWrapper(Context context) { super(context); } public SwipeRefreshWrapper(Context context, AttributeSet attrs) { super(context, attrs); } public void setScrollResolview(ScrollResolview scrollResolview) { mScrollResolview = scrollResolview; } @Oviewride public boolean canChildScrollUp() { if(mScrollResolview != null){ return mScrollResolview.canScrollUp(); }else { return super.canChildScrollUp(); } } public static interface ScrollResolview{ public boolean canScrollUp(); } } 

    Uso ( ListView também possui um método agradável: canScrollVertically() ):

     final SwipeRefreshWrapper wrapper = (SwipeRefreshWrapper) rootView.findViewById(R.id.wrapper); final ListView list = (ListView) rootView.findViewById(R.id.list); wrapper.setScrollResolview(new SwipeRefreshWrapper.ScrollResolview() { @Oviewride public boolean canScrollUp() { return list.canScrollVertically(-1); } }); } final SwipeRefreshWrapper wrapper = (SwipeRefreshWrapper) rootView.findViewById(R.id.wrapper); final ListView list = (ListView) rootView.findViewById(R.id.list); wrapper.setScrollResolview(new SwipeRefreshWrapper.ScrollResolview() { @Oviewride public boolean canScrollUp() { return list.canScrollVertically(-1); } }); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.