Android SweepRefreshLayout Update Indicator Not Displaying

I am using the android.support.v4.widget.SwipeRefreshLayout file inside the fragment. A swipe works great to update my data, but all I see is an empty white circle as a swipe indicator. All the other questions I saw about this do not seem to work.

@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_all_assets,container,false); mListView = (ListView) view.findViewById(R.id.listView); mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); mSwipeLayout.setColorSchemeColors(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); return view; } 

XML

 <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/listView" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"/> </android.support.v4.widget.SwipeRefreshLayout> 

Dependencies

 compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v13:21.0.0' compile 'com.android.support:appcompat-v7:21.0.+' compile 'com.google.zxing:android-integration:3.1.0' 

How can I make this update indicator work?

+5
source share
1 answer

The problem is that setColorSchemeColors() expects integer color colors as inputs (e.g. Color.BLUE ) rather than color resource identifiers.

Instead, you should use setColorSchemeResources() , which accepts references to color resources.

+16
source

Source: https://habr.com/ru/post/1205813/


All Articles