android.widget.ExpandableListView.onMeasure()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(258)

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

ExpandableListView.onMeasure介绍

暂无

代码示例

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

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST);

    super.onMeasure(widthMeasureSpec, expandSpec);
  }
}

代码示例来源:origin: lucid-lynxz/BlogSamples

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    //999999 is a size in pixels. ExpandableListView requires a maximum height in order to do measurement calculations.
    heightMeasureSpec = MeasureSpec.makeMeasureSpec(999999, MeasureSpec.AT_MOST);
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }
}

代码示例来源:origin: lucid-lynxz/BlogSamples

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  if (mHeaderView != null) {
    measureChild(mHeaderView, widthMeasureSpec, heightMeasureSpec);
    mHeaderViewWidth = mHeaderView.getMeasuredWidth();
    mHeaderViewHeight = mHeaderView.getMeasuredHeight();
  }
}

代码示例来源:origin: adafruit/Bluefruit_LE_Connect_Android

@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  // HACK! TAKE THAT ANDROID!
  if (isExpanded()) {
    // Calculate entire height by providing a very large height hint.
    // View.MEASURED_SIZE_MASK represents the largest height possible.
    int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST);
    super.onMeasure(widthMeasureSpec, expandSpec);
    ViewGroup.LayoutParams params = getLayoutParams();
    params.height = getMeasuredHeight();
  } else {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }
}

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

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (!DeviceFormFactor.isTablet(getContext())) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    return;
  }
  // Increase padding if needed to ensure children are no wider than mMaxListViewWidth.
  int childWidth = MeasureSpec.getSize(widthMeasureSpec);
  int excessWidth = childWidth - mMaxListViewWidth;
  int horizontalPadding = 0;
  if (excessWidth > 0) {
    horizontalPadding += excessWidth / 2;
  }
  setPadding(horizontalPadding, 0, horizontalPadding, 0);
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

相关文章

ExpandableListView类方法