I use SwipeRefreshLayout to update my list.
everything works. but I do not like the progress bar. It is round. and carried the arrow to spin. I have seen examples in which a strip of moving from the center to the edges. How to set up a progress bar style?
private SwipeRefreshLayout swipeLayout;
...
swipeLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_guest_list);
swipeLayout.setColorSchemeColors(Color.RED, Color.GREEN, Color.BLUE, Color.CYAN);
swipeLayout.setOnRefreshListener(this);
example I need both the video
This Is My Example
webframe = WebView
swipeContainer = swipeLayout
swipeContainer.setOnRefreshListener {
webframe.reload()
swipeContainer.setColorSchemeColors(Color.WHITE)
swipeContainer.setProgressBackgroundColorSchemeColor(Color.rgb(0,165,165))
}
You can't change the animation.
In SwipeRefreshLayout
you can't customize much; I believe this is an attempt of Google to get developers stick to common patterns. What you can style are the four colors of the animation, specified with setColorScheme()
.
SwipeRefreshLayout
takes care to show its predefined animation at its top for you. This can be when canChildScrollUp()
returns false and user 'pulls down', or when you set setRefreshing(true)
. Turn off the animation with setRefreshing(false)
. Put your logic in the method onRefreshing()
of the listener. Override canChildScrollUp()
if you put something that is not a ListView
in your SwipeRefreshLayout
. You should be good to go from here.
You can actually change it to the older progress bar one, by giving reference to the older jar file of the support-v4 library. I had the same issue suddenly after updating eclipse, i just copied the older support-v4.jar to projects libs folder and then using project properties references this support-v4.jar and then clean and built the project and now it was using the old classes. This solution is suitable if you are not using anything particular from the updated support library.
You can play with different colors of the swipe's progress var:
swipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.orange);
where blue, green and orange are defined in colors.xml
setColorSchemeResources receives a varargs, so you can play with the number of colors there
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