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.
Is there anyway to modify the ImageView
?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With