2012-12-07 2 views

답변

2

당신은 다음과 같이 그것을 찾을 수 있습니다

개인 GestureDetector.SimpleOnGestureListener simpleOnGestureListener = 새로운 GestureDetector.SimpleOnGestureListener() {

};

+0

오른쪽 토륨하기 e 점; 고맙습니다! – Sipty

0

약간의 로직이 나에게 도움이되었습니다. 두 개의 포인터 [firstPointerCurrentValue,firstPointerLastValue] (간단히 말해서 firstPointer는 list의 첫 번째 보이는 아이템을 가리키는 변수입니다)을 가져 와서 새롭고 업데이트 된 values.`

int firstPointerCurrentValue = 0; 
int firstPointerLastValue = 0; 

........

lv.setOnScrollListener(new OnScrollListener() { 
     @Override 
     public void onScrollStateChanged(AbsListView alv, int scrollState) { 

      checkValue(firstPointerCurrentValue, firstPointerLastValue); 
      firstPointerLastValue = firstPointerCurrentValue; 
     } 

     @Override 
     public void onScroll(AbsListView view, int firstVisibleItem, 
       int visibleItemCount, int totalItemCount) { 

      firstPointerCurrentValue = firstVisibleItem; 

     } 
    }); 

......

boolean checkValue(int firstPointerCurrentValue, int firstPointerLastValue) { 

    if (firstPointerCurrentValue > firstPointerLastValue) { 
     Toast.makeText(getBaseContext(), "DOWN ", Toast.LENGTH_SHORT) 
     .show(); 
     ab.hide(); 
    } else if (firstPointerCurrentValue < firstPointerLastValue) { 
     Toast.makeText(getBaseContext(), "UP ", 
     Toast.LENGTH_SHORT).show(); 

    } else { 
     // Toast.makeText(getBaseContext(), "No Move ", Toast.LENGTH_SHORT) 
     // .show(); 
    } 

    return false; 
} 
관련 문제