pull to refresh - why android swiperefreshlayout onRefresh() method is also called when I swipe the screen horizontally? -
i have implemented android gmail pull refresh(using google swiperefreshlayout class), annoying when swipe screen horizontally, calls onrefresh() making difficult me use. want use vertical scrolling feature only. in advance.
xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout 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/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent" > <relativelayout 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:layout_centerinparent="true" android:orientation="vertical" > <linearlayout android:id="@+id/view1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal" > </linearlayout> </linearlayout> </relativelayout> </android.support.v4.widget.swiperefreshlayout> </linearlayout>
java code:
swiperefreshlayout swipelayout = (swiperefreshlayout) view.findviewbyid(r.id.swipe_container); swipelayout.setcolorscheme(android.r.color.holo_blue_bright, android.r.color.holo_green_light, android.r.color.holo_orange_light, android.r.color.holo_red_light); swipelayout.setonrefreshlistener(new onrefreshlistener() { @override public void onrefresh() { //some task here } });
Comments
Post a Comment