Open fsxiaoke opened 5 years ago
感谢你的反馈,Weex目前是隶属于Apache Software Foundation的项目,因此在Gtihub渠道我们鼓励使用英文反馈问题。下面我将使用Google Trasnlate将你的问题翻译成英语,并以英语回答。
Question Description: [Android] When the parent (vertical layout) property flex:1 is set, the child is not displayed.
This is a bug, of course. But it may take a really long time to fix as many UI behaviour relies on the layout code. I am glad if you can give us a PR.
I will briefly explain the layout algorithm and the reason of the bug below. There are two computing phase during Weex Layout.
hypotheticalWidth
and hypotheticalHeight
based onwidth
, height
, border-width,
padding,
margin`width
and height
based on hypotheticalWidth
, hypotheticalHeight``flex-direcon
, align-items
, flex
and any other flexbox related styles.During phase 1, the width of the text or its parent is unknown, the layout algorithm has no way but assumes it is unlimited, e.g. a single line text.
During phase 2, the width and height of the text is correct, but the height of text's parent is still wrong.
You got what you see.
现象: left里的5个文本控件展示不全 如果把left设为定宽就没问题了
weex sdk:0.24.0 code:
下边的逻辑是不是写反了? direction为column时宽采用最宽的child,高是child的总和