zoukankan      html  css  js  c++  java
  • SupportV7包中 SwipeRefreshLayout 修改下拉控件的距离

     1  //修改下拉距离
     2         ViewTreeObserver vto = mCategoryResults.mSwipeRefreshLayout.getViewTreeObserver();
     3         vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
     4             public void onGlobalLayout() {
     5 
     6                 final DisplayMetrics metrics = getResources().getDisplayMetrics();
     7                 Float mDistanceToTriggerSync = Math.min(((View) mCategoryResults.mSwipeRefreshLayout.getParent()).getHeight() * 0.6f, 500 * metrics.density);
     8 
     9                 try {
    10                     Field field = SwipeRefreshLayout.class.getDeclaredField("mDistanceToTriggerSync");
    11                     field.setAccessible(true);
    12                     field.setFloat(mCategoryResults.mSwipeRefreshLayout, mDistanceToTriggerSync);
    13                 } catch (Exception e) {
    14                     e.printStackTrace();
    15                 }
    16                 ViewTreeObserver obs = mCategoryResults.mSwipeRefreshLayout.getViewTreeObserver();
    17                 obs.removeOnGlobalLayoutListener(this);
    18             }
    19         });
  • 相关阅读:
    两排滚动js
    弹性布局
    channelartlist添加栏目链接
    首页调取二级、三级栏目
    dede完美分页样式
    如何安装sass
    首页分页(自由列表)
    tag标签调取
    25.简单的路由
    24.简单的自定义服务
  • 原文地址:https://www.cnblogs.com/dennisac/p/4699978.html
Copyright © 2011-2022 走看看