android.widget.ScrollView.onLayout()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中android.widget.ScrollView.onLayout()方法的一些代码示例,展示了ScrollView.onLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.onLayout()方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:onLayout

ScrollView.onLayout介绍

暂无

代码示例

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null) {
    return;
  }
  // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(), contentView.getRight(),
      contentView.getBottom());
}

代码示例来源:origin: smuyyh/BookReader

/**
 * 在该方法中获取ScrollView中的唯一子控件的位置信息 这个位置信息在整个控件的生命周期中保持不变
 */
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null)
    return;
  // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(), contentView.getRight(), contentView.getBottom());
}

代码示例来源:origin: rey5137/material

@Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    View child = getChildAt(0);
    showDivider(child != null && child.getMeasuredHeight() > getMeasuredHeight() - getPaddingTop() - getPaddingBottom());
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    layHeader = (ViewGroup) findViewById(R.id.layHeader);
    if (layHeader == null || layHeader.getChildCount() == 0 || layHeader.getHeight() == 0) {
      return;
    }

    if (layBar == null) {
      layBar = (ViewGroup) findViewById(R.id.layBar);
      viewPager = (ViewPager) findViewById(R.id.viewPager);
      viewPager.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, getHeight() - layBar.getHeight()));

//            Logger.d(TAG, "HeaderViewHeight = " + layHeader.getHeight() + ", BarHeight = " + layBar.getHeight() + ", top = " + getScrollY());
    }
  }

代码示例来源:origin: jberkel/sms-backup-plus

@Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    scrollTo(0, view.getHeight());
  }
};

代码示例来源:origin: klaszlo8207/StretchTopViewExample

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
}

代码示例来源:origin: smuyyh/SprintNBA

/**
 * 在该方法中获取ScrollView中的唯一子控件的位置信息 这个位置信息在整个控件的生命周期中保持不变
 */
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null)
    return;
  // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(), contentView.getRight(), contentView.getBottom());
}

代码示例来源:origin: HotBitmapGG/LeisureRead

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
 super.onLayout(changed, l, t, r, b);
 if (contentView == null) {
  return;
 }
 // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
 originalRect.set(contentView.getLeft(), contentView.getTop(), contentView.getRight(),
   contentView.getBottom());
}

代码示例来源:origin: TheMelody/LotteryTrend

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null) return;
  //ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(), contentView
      .getRight(), contentView.getBottom());
}

代码示例来源:origin: ThinkBear/GrabRedPacket

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null)
    return;
  // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(),
      contentView.getRight(), contentView.getBottom());
}

代码示例来源:origin: caichengan/ShoppingCartActivity

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (contentView == null)
    return;
  // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
  originalRect.set(contentView.getLeft(), contentView.getTop(),
      contentView.getRight(), contentView.getBottom());
}

代码示例来源:origin: FussenYu/MVP_Project

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
 super.onLayout(changed, l, t, r, b);
 if (contentView == null) {
  return;
 }
 // ScrollView中的唯一子控件的位置信息, 这个位置信息在整个控件的生命周期中保持不变
 originalRect.set(contentView.getLeft(), contentView.getTop(), contentView.getRight(),
   contentView.getBottom());
}

代码示例来源:origin: derry/delion

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
  super.onLayout(changed, left, top, right, bottom);
  notifyIfScrolledToBottom(true);
}

代码示例来源:origin: moz1q1/WalleLibrary

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (!clipToPaddingHasBeenSet) {
    clippingToPadding = true;
  }
  notifyHierarchyChanged();
}

代码示例来源:origin: colinNaive/RecyclerViewScrollView

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if (changed) {
    LinearLayout linearLayout = (LinearLayout) getChildAt(0);
    if (linearLayout != null) {
      for (int i = 0; i < linearLayout.getChildCount(); i++) {
        if (linearLayout.getChildAt(i).getTag() != null && linearLayout.getChildAt(i).getTag().equals("fix")) {
          fixView = linearLayout.getChildAt(i);
        }
      }
    }
  }
}

代码示例来源:origin: colinNaive/RecyclerViewScrollView

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
  super.onLayout(changed, left, top, right, bottom);
  if(changed){
    LinearLayout v = (LinearLayout) getChildAt(0);
    if(v != null){
      for(int i=0;i<v.getChildCount();i++){
        if(v.getChildAt(i).getTag() != null && ((String)v.getChildAt(i).getTag()).equals("aaa")){
          view = v.getChildAt(i);
          break;
        }
      }
    }
  }
}

代码示例来源:origin: cjiahuan/ReboundScrollView

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  Log.d(TAG, "onlayout");
  if (getChildCount() > 0)
    childView = getChildAt(0);
  if (childView == null)
    return;
  originalRect.set(childView.getLeft(), childView.getTop(),
      childView.getRight(), childView.getBottom());
}

代码示例来源:origin: mtotschnig/MyExpenses

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  final View child = getChildAt(0);
  if (child != null) {
    mScrollThreshold = Math.max(0, child.getMeasuredHeight() - b + t - getPaddingBottom());
  }
  if (b - t > 0) {
    // Post check scroll in the next run loop, so that the callback methods will be invoked
    // after the layout pass. This way a new layout pass will be scheduled if view
    // properties are changed in the callbacks.
    post(mCheckScrollRunnable);
  }
}

代码示例来源:origin: amarjain07/StickyScrollView

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  super.onLayout(changed, l, t, r, b);
  if(stickyFooterView != null && !changed) {
    stickyFooterView.getLocationInWindow(updatedFooterLocation);
    mStickyScrollPresenter.recomputeFooterLocation(getRelativeTop(stickyFooterView), updatedFooterLocation[1]);
  }
}

相关文章

ScrollView类方法