开始使用SwipeRefreshLayout中容纳一个ListView的时候进行刷新不会有任何问题,但是当我把SwipeRefreshLayout中的子元素换成TextView后问题出现了,刷新的时候动画显示居然不完整!刚跳出来就结束了。
查询文档,文档中有这么一句
If an activity wishes to show just the progress animation, it should call setRefreshing(true)
不幸的是问题依旧。
后来参看了 匆忙拥挤repeat 的代码 将ScrollView作为SwipeRefreshLayout的子元素,将TextView添加到ScrollView中,问题圆满解决。
附上测试源码
布局文件 activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margi