SwipeRefreshLayout: Swipe progress animation

前端 未结 2 1251
无人及你
无人及你 2020-12-14 11:37

I\'m quite new to android and I\'m exploring the sample code on google website. The code I\'m on currently is the SwipeRefreshLayout: http://developer.android.com/samples/Sw

2条回答
  •  青春惊慌失措
    2020-12-14 12:13

    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.

提交回复
热议问题