SwipeRefreshLayout - 向下滑动以刷新,但不动的观点拉下 [英] SwipeRefreshLayout - swipe down to refresh but not move the view pull down

查看:193
本文介绍了SwipeRefreshLayout - 向下滑动以刷新,但不动的观点拉下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能?作为标题说

Is it possible ?? as a Title said

向下滑动以刷新布局,但坚持布局不是沿着其向下移动刷卡gusture

swipe down to refresh Layout but stick the Layout not move it down along swipe gusture

感谢您 - 我使用SwipeRefreshLayout

Thank you - I'm using SwipeRefreshLayout

推荐答案

我的反复试验后,我发现了一个解决方案,从

After my trial and error, I found one solution from

http://www.dailydevbook.de/android-swiperefreshlayout-without-overscroll /

有关的人谁可以实现SwipeRefreshLayout,为了实现它

For people who can implement SwipeRefreshLayout, in order to achieve it

步骤1:下载从github上Android的支持V4(开放源代码)

STEP 1: DOWNLOAD android-support v4 (Open Source) from github

步骤2:复制下面的Java类到你的项目的src

STEP 2: COPY following java class to your project src

  • SwipeRefreshLayout
  • SwipeProgressBar
  • BakedBezierInterpolator

note1-(重构SwipeRefreshLayout到mySwipeRefreshLayout至prevent与原来的混乱) note2-(修正这些类和使用的源彼此,而不是V4)

note1- (Refactor SwipeRefreshLayout to mySwipeRefreshLayout to prevent confusing with original) note2- (Fix these classes and use the source from each other instead of v4)

步骤3:更新code 使用

  • mySwipeRefreshLayout的而不是
  • SwipeRefreshLayout

步骤4:更新布局使用

  • com.yourpackage.mySwipeRefreshLaout的而不是
  • android.support.v4.widget.SwipeRefreshLayout

第五步:在您的mySwipeRefreshLayout.java,查找并修改到以下code

STEP 5: In your mySwipeRefreshLayout.java, find and change to a following code

private  void  updateContentOffsetTop ( int  targetTop) {
        final  int  currentTop = mTarget.getTop ();
        if  (targetTop> mDistanceToTriggerSync) {
            targetTop = ( int ) mDistanceToTriggerSync;
        } else  if  (targetTop < 0 ) {
            targetTop = 0 ;
        }
        // SetTargetOffsetTopAndBottom (targetTop - currentTop);
        setTargetOffsetTopAndBottom ( 0 ); // MOD: Prevent Scroll Down Animation
    }

这篇关于SwipeRefreshLayout - 向下滑动以刷新,但不动的观点拉下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆