I' m using SwipeRefreshLayout in a Fragment inside an Activity. It work fine when i'm swipe down but when first time Fragment create and load data. It just has a blank circle without animation load arrow , like this:
My code show SwipeRefreshLayout :
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.item_order_fragment, container, false);
ButterKnife.bind(this, v);
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setColorSchemeResources(R.color.startColorPrimary,
R.color.color_tab_selected,
R.color.endColorPrimary);
mSwipeRefreshLayout.setRefreshing(true);
return v;
}
@Override
public void onRefresh() {
// Fetching data from server
}
My xml layout :
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tv_order_status_explain"
android:background="@android:color/transparent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_orders"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
tools:listitem="@layout/item_customer_order" />
</android.support.v4.widget.SwipeRefreshLayout>
I has try every solution in this SwipeRefreshLayout setRefreshing() not showing indicator initially but nothing work. Can anyone helps me with this ?