3 Star 44 Fork 10

Ryan Zhu / OhosExtension

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
EstimateHelper.md 991 Bytes
一键复制 编辑 原始数据 按行查看 历史
朱帆 提交于 2021-07-23 11:05 . update readme

EstimateHelper

测量帮助类,提供一些通用的测量方法

使用

  • 根据size与mode生成EstimateSpec,与安卓的MeasureSpec.makeMeasureSpec(int size, int mode)实现一致
EstimateHelper.makeEstimateSpec(size, mode);
  • 根据父component的spec、padding以及子component的期望大小,生成子component的spec。与安卓中ViewGroup.getChildMeasureSpec(int spec, int padding, int childDimension)实现一致
EstimateHelper.getChildMeasureSpec(parentSpec, padding, childSize);
  • 决定控件的大小,除非有特别的约束,否则会返回控件想要的大小。与安卓中View.resolveSize(int size, int measureSpec)实现基本一致
EstimateHelper.resolveSizeAndState(size, measureSpec);
  • 获取控件的默认大小,除非有特别的约束,否则会返回控件想要的大小。与安卓中View.getDefaultSize(int size, int measureSpec)实现一致
EstimateHelper.getDefaultSize(size, measureSpec);
Java
1
https://gitee.com/thoseyears/ohos-extension.git
git@gitee.com:thoseyears/ohos-extension.git
thoseyears
ohos-extension
OhosExtension
master

搜索帮助