2014-04-10 1 views
0

다음은 내 레이아웃 xml입니다. ScrollView Inside ScrollView일반 스크롤보기에서 스크롤 뷰를 새로 고치기 위해 스크롤하는 방법

그러나, 그것은 작동하지 않았다 :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/garae_scroll" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@color/background" 
android:fillViewport="true" 
android:focusableInTouchMode="false" > 
    <RelativeLayout> 
     ... 
     <com.handmark.pulltorefresh.library.PullToRefreshScrollView> 
     <LinearLayout/> 
     </com.handmark.pulltorefresh.library.PullToRefreshScrollView> 
    </RelativeLayout> 
</ScrollView> 

는 이미이 링크에서 솔루션을 시도했다. 자식 PullToRefreshScrollView를 어떻게 사용할 수 있습니까 ?? 도와주세요.

답변

6

질문이 있으시면 Scrollview에서 새로 고치기 위해 구현을 원할 것입니다. 사용중인 라이브러리를 사용하는 대신 SwipeRefreshLayout을 구현하는 것이 좋습니다. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html Google+ 또는 Gmail과 같이 새로 고침을 구현하는 레이아웃입니다.

Here an example of how to implement the SwipeRefreshLayout in your xml : 

    <?xml version="1.0" encoding="utf-8"?> 

    <FrameLayout 
     android:layout_width="match_parent" android:layout_height="match_parent" 
     xmlns:android="http://schemas.android.com/apk/res/android" > 

     <android.support.v4.widget.SwipeRefreshLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/swipe_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/garae_scroll" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 

     </ScrollView> 

     </android.support.v4.widget.SwipeRefreshLayout> 
</FrameLayout> 

참고

는 고도로있는 ScrollView/목록보기 안에있는 ScrollView/목록보기를 넣어을하지 않는 것이 좋습니다. 첫 번째 이유는 성능에 관한 것이고 Romain Guy는 하나의 비디오에서이 점을 설명합니다. https://www.youtube.com/watch?v=wDBM6wVEO70

+0

감사합니다. Hugo 나는 많은 예제를 살펴 보았지만 쿼리 리스너를 구현해야한다고 언급하지 않았습니다. – dharmesh

관련 문제