fragment - scrollview inside override swiperefreshlayout always indicating refresh icon android -
i want use scroll view inside swipe refresh layout refresh icon indicating continuously on particular fragment. how solve error?
or other ways implement scroll view inside swipe refresh layout?
xml layout , override swipe refresh layout code given below.
layout
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <com.org.myapp.myrefreshlayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/refresh_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/light_grey"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <include android:id="@+id/cricket_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/item_breaking" /> <android.support.v7.widget.recyclerview android:id="@+id/rvdummy" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" /> </linearlayout> </scrollview> </com.org.myapp.myrefreshlayout> </framelayout> override swipe refresh layout
public class myrefreshlayout extends swiperefreshlayout { private boolean mmeasured = false; private boolean mpremeasurerefreshing = false; public myrefreshlayout(context context) { super(context); } public myrefreshlayout(context context, attributeset attrs) { super(context, attrs); } @override public void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); if (!mmeasured) { mmeasured = true; setrefreshing(mpremeasurerefreshing); } } @override public void setrefreshing(boolean refreshing) { if (mmeasured) { super.setrefreshing(refreshing); } else { mpremeasurerefreshing = refreshing; } } }
Comments
Post a Comment