钛合金/加速器中Ti.UI.Fill与100%的区别

Yah*_*din 3 titanium appcelerator titanium-alloy appcelerator-titanium appcelerator-alloy

以下填充整个屏幕:

<View height="Ti.UI.FILL" width="Ti.UI.FILL">...</View>
Run Code Online (Sandbox Code Playgroud)

fill属性在这里描述:http://docs.appcelerator.com/platform/latest/#!/ api/Titanium.UI- property- FILL

但是你也可以使用以下方法做同样的事情:

<View height="100%" width="100%">...</View>
Run Code Online (Sandbox Code Playgroud)

因此我的问题是,有什么区别?

Mau*_*tti 5

官方指南说:"Ti.UI.FILL行为代表了一个填充其父级维度的视图.请注意,FILL行为不会考虑父级中的其他同级元素." http://docs.appcelerator.com/platform/latest/#!/guide/Layouts,_Positioning,_and_the_View_Hierarchy

当然Ti.UI.FILL是一个Titanium常量,你可以在任何地方使用,而100%是一个字符串.我总是喜欢第一个.当我们将两个元素放在同一个容器中给一个FILL而另一个放置一个固定大小,或者给第一个100%和另一个固定大小时,可能会有区别,但通常当我使用一个视图时它应该填充一个空间,它是容器中唯一的空间,所以我从来没有注意到任何差异.