如何滚动拉动以刷新正常scrollview中的scrollview

use*_*556 2 layout android refresh pull scrollview

这是我的布局xml.

<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>
Run Code Online (Sandbox Code Playgroud)

我已经在这个链接中尝试了解决方案: ScrollView Inside ScrollView

但是,它没有用.如何使用子PullToRefreshScrollView?请帮我.

Hug*_*ugo 9

如果我理解您的问题,您希望在Scrollview中实现Pull to refresh.而不是使用你正在使用的库,我建议你实现一个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>
Run Code Online (Sandbox Code Playgroud)

注意

这是强烈建议不要把一个滚动型/列表视图滚动型/列表视图中.第一个原因是关于性能和Romain Guy在一个视频中解释这个视频https://www.youtube.com/watch?v=wDBM6wVEO70