Make a custom SwipeRefreshLayout Indicator?

How would I go about making a custom indicator that would use a drawable object with a custom animation for the SwipeRefreshLayout?

I looked over the source code for SwipeRefreshLayout and I noticed the CircleImageView object was private.

  • How to set layout_span through code
  • How to set name of AAR output from Gradle
  • Android Browser Triggers jQuery $(window).resize() on scrolling
  • Adding view to bottom of layout inside a scrollview
  • Get href value from anchor tag in Android WebView when link is clicked
  • How to create modal dialog box in android
  • Is there anyway to modify the ImageView?

    Related posts:

    Implicit “Submit” after hitting Done on the keyboard at the last EditText
    Distance between two android phones
    Loading shared libs that depend on other shared libs
    Android SDK and AVD Manager Error: File not found: C:\Program Files (x86)\Android\android-sdk\temp\
    Android contentprovider insert takes a lot of time
    Porting AWT graphics code to Android
  • How can I get the device name in Android?
  • Android: How to create a GridLayout programmatically?
  • Incremental Opacity, wanting constant opacity Image View with Drawable
  • How to set theme to ProgressDialog?
  • How to change the Tabs Images in the TabHost
  • How to support dpad controls for RecyclerView
  • 2 Solutions collect form web for “Make a custom SwipeRefreshLayout Indicator?”

    You can change the drawable via reflection, not sure how good this idea is. Something like :

    mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.your_swiperefresh_id);
    try {
        Field f = mSwipeRefreshLayout.getClass().getDeclaredField("mCircleView");
        f.setAccessible(true);
        ImageView img = (ImageView)f.get(mSwipeRefreshLayout);
        img.setImageResource(R.drawable.your_drawable_file);
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    

    Try https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh.
    Modify System widget is troublesome.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.