我正在构建一些 Mount Spec 组件来渲染特定的 View 。我所有的 View 都应该有 height = "wrap_content"。
当我第一次开始使用它时,我没有实现 onMerasure() 方法(使用 @OnMeasure 注释),所以该组件不会显示任何内容!实现 onMeasure() 后,组件开始工作,但由于资源可用,无法计算组件高度(应在 onMeasure 内完成)。
如何让 Litho Mount Spec 与没有固定高度的 View 一起工作?
最佳答案
放:
MeasureUtils.measureWithAspectRatio(widthSpec, heightSpec, aspectRatio, size);
在你的 onMeasure() 函数中
关于android - 将 MountSpec 组件与 "wrap_content" View 一起使用 - 如何实现 onMeasure(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45512940/