我在AppCompat ListFragment中使用SwipeRefreshLayout。我拉动刷新似乎工作正常但有时在日志中我可以看到以下错误。如果我在刷新或刚刚完成刷新时再次拉动列表,则会发生这种情况。
E/SwipeRefreshLayout: Got ACTION_MOVE event but don't have an active pointer id.
我的布局代码是:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/activity_main_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
/>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
在ListFragment中,我重写onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.list_layout, container, false);
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.activity_main_swipe_refresh_layout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
log.d("swipeRefreshLayout onRefresh");
onRefreshList();
}
});
adapter = new ItemAdapter(getActivity());
setListAdapter(adapter);
return view;
}