本文介绍了SwipeRefreshLayout与上面的scrollView和Layout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的布局如下
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
//some views here
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
</TableLayout>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
问题是当我向下滚动表格时,由于触发了滑动布局,我无法再次向上滚动.仅当表格的第一个视图可见时,我如何才能触发swiperefresh?
The problem is when I scrolldown the table, I can't scrollUp again because the swipelayout is being triggered. How can I trigger the swiperefresh only when the first view of the table is visible?
推荐答案
我发现,如果将ScrollView
替换为android.support.v4.widget.NestedScrollView
,则滚动行为将按您期望的那样工作.
I found that if you replace your ScrollView
with a android.support.v4.widget.NestedScrollView
the scrolling behavior will work as you expect it to.
这篇关于SwipeRefreshLayout与上面的scrollView和Layout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!