由此我的意思是我有一个简单的swipeRefreshLayout,我希望当用户向下滚动到更加困难时,直到完成栏和triger onRefresh方法。像Gmail这样的东西。有可能吗?
答案 0 :(得分:1)
如果你只想要更难向下滑动,你可以修改SwipeRefreshLayout
来源,制作自己的SwipeRefreshLayout:
public class SwipeRefreshLayout extends ViewGroup {
private static final long RETURN_TO_ORIGINAL_POSITION_TIMEOUT = 300;
private static final float ACCELERATE_INTERPOLATION_FACTOR = 1.5f;
private static final float DECELERATE_INTERPOLATION_FACTOR = 2f;
private static final float PROGRESS_BAR_HEIGHT = 4;
private static final float MAX_SWIPE_DISTANCE_FACTOR = .6f;
private static final int REFRESH_TRIGGER_DISTANCE = 120; \\ change this value
但是如果你想像Gmail一样在ActionBar上出现一个栏,我建议你不要在支持库中使用SwipeRefreshLayout
,而是使用像ActionBar-PullToRefresh这样的库。