2016-12-27 71 views

回答

3

下面的代碼將工作,檢測,如果你的列表的最上面一行是第一行:

lstView.setOnScrollListener(new AbsListView.OnScrollListener() { 

      @Override 
      public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { 
       if (firstVisibleItem == 0){ 
        Toast.makeText(context, "Scroll to Top ", Toast.LENGTH_SHORT).show(); 
       } 
      } 
     });