Example #1
0
  @Override
  protected void measureChildren(int widthMeasureSpec, int heightMeasureSpec) {
    int width = getDefaultSize(0, widthMeasureSpec);
    int height = getDefaultSize(0, heightMeasureSpec);

    int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
    int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
      final View child = getChildAt(i);
      measureChild(child, childWidthMeasureSpec, childHeightMeasureSpec);
    }
  }
Example #2
0
 private void measureAndLayoutChild(View v) {
   int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY);
   int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY);
   measureChild(v, childWidthMeasureSpec, childHeightMeasureSpec);
   layoutChild(v);
 }