alibaba / VirtualView-iOS

A solution to create & release UI component dynamically.
MIT License
507 stars 77 forks source link

VVRatioLayout在calculateLayoutSize时,计算比例size没有减去margin,跟Android的逻辑不一致 #19

Closed zekunyan closed 6 years ago

zekunyan commented 6 years ago

https://github.com/alibaba/VirtualView-iOS/blob/4a96df7ce342690bade4499c7c0d42ecc1031ed8/VirtualView/LayoutView/VVRatioLayout.m#L170

如题,在计算有ratio的size时,Android是减去了margin才算的,iOS的没有,会导致两端不一致。

Android的源码:

// RatioLayout.java的249行
if (p.mLayoutRatio <= 0) {
    mFixDim += child.getComMeasuredHeightWithMargin();
} else {
    mFixDim += p.mLayoutMarginTop + p.mLayoutMarginBottom;
}
HarrisonXi commented 6 years ago

后续会确认下 css 或者 flex 的规范,按照规范进行两端同步

HarrisonXi commented 6 years ago

release 1.2.2 已解决