2014-09-24 2 views
5

ListView 끌어 오기를 새로 고치는 라이브러리가 많이 있습니다. 그러나 그들은 위에서 아래로 당길 때 일하는 것이지만 아래에서 위로 끌어 올 때 새로 고침을 할 수 있습니까? SwipeRefreshLayout으로 이것을 만들 수 있습니까? 없으면 어떤 라이브러리를 사용해야합니까? 어떻게 그럴 수 있죠?새로 고침을 위해 설정하는 방법 SwipeRefreshLayout

+0

[? 쉬운 와이프 투 리프레시 인 android.html spref = TW (http://techdroid.kbeanie.com/2014/06/easy-swipe-to -refresh-in-android.html? spref = tw) –

+0

당신은 onTouch를 오버라이드하여 구현할 수 있습니다. – Blackbelt

+1

은 라이브러리를 편집하기 만하면됩니다. 대부분 onTouch() 이벤트를 사용하고, 논리를 MotionEvent.ACTION_DOWN에 넣고 확인합니다 목록에 마지막에'if ((firstVisibleItem + visibleItemCount) == totalItemCount)'라고 쓰면 간단히 새로 고침 –

답변

2

사용 chrisbanes의 라이브러리 : 목록보기, gridview에,있는 ScrollView, 웹보기를 지원 https://github.com/chrisbanes/Android-PullToRefresh ...

그것을 위해, 바닥에서 바로 설정 모드 목록보기를 새로 고치려면. 다음은 예이다 :

PullToRefreshListView ptr= 
    (PullToRefreshListView) findViewById(R.id.listview); 
mPullRefreshListView.setMode(Mode.BOTH); // mode refresh for top and bottom 
mPullRefreshListView.setShowIndicator(false); //disable indicator 
mPullRefreshListView.setPullLabel("Loading"); 

ptr.setOnRefreshListener(new OnRefreshListener<ListView>() { 
      public void onRefresh(PullToRefreshBase<ListView> refreshView) { 
      //do something when refresh 
}); 
관련 문제