首页 > 代码库 > 用Fragment实现Listview顶部停靠

用Fragment实现Listview顶部停靠

  1. @Override  
  2. public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {  
  3.     float headerMoveDistance = ViewHelper.getTranslationY(headerView);  
  4.     if (headerMoveDistance <= -headerContent.getHeight()) {  
  5.         iv_tabMore.setVisibility(View.VISIBLE);  
  6.         iv_tabBack.setVisibility(View.VISIBLE);  
  7.   
  8.         ll_top.setVisibility(View.INVISIBLE);  
  9.   
  10.     } else {  
  11.         iv_tabMore.setVisibility(View.INVISIBLE);  
  12.         iv_tabBack.setVisibility(View.INVISIBLE);  
  13.   
  14.         ll_top.setVisibility(View.VISIBLE);  
  15.     }  
  16.     int scrollY = getScrollY(view);  
  17.     System.out.println("****************onScroll scrollY:" + scrollY + ",mMinHeaderTranslation:"  
  18.             + header_logo.getHeight() + ",end:" + Math.max(-scrollY, header_logo.getHeight()));  
  19.   
  20.     ViewHelper.setTranslationY(headerView, Math.max(-scrollY, -headerContent.getHeight()));  

用Fragment实现Listview顶部停靠