我在我的Android应用程序上使用底部的工具栏,但我不知道如何使其项目具有相同的宽度,因此它们是对齐的。这是我的工具栏看起来像(所有项目都在左边,它们之间没有分离):如何对齐Ti.UI.Toolbar项目? (Android Appcelerator)
这是我想要实现(项目分离,并居中)什么:
我试着将每个项目/视图的宽度设置为“33%”,但这不起作用。
我正在使用Titanium SDK 6.2.2 GA。请参阅我下面的代码:
合金的xml:
<Toolbar width="Ti.UI.FILL" bottom="0" barColor="#639851" horizontalWrap="false">
<Items>
<View id="addView" class="bottomBtn" onClick="addDirection">
<ImageView class="icons" image="/icons/add.png" touchEnabled="false" />
<Label class="label" text="Add" touchEnabled="false" />
</View>
<View id="mapView" class="bottomBtn" onClick="showMap">
<ImageView class="icons" image="/icons/map.png" touchEnabled="false" />
<Label class="label" text="See map" touchEnabled="false" />
</View>
<View id="routeView" class="bottomBtn" onClick="calculateRoute">
<ImageView class="icons" image="/icons/optimize.png" touchEnabled="false" />
<Label class="label" text="Calculate" touchEnabled="false" />
</View>
</Items>
</Toolbar>
TSS:
".label" : {
color: "#212121"
}
".icons" : {
width: "24dp",
height: "24dp"
}
".bottomBtn" : {
layout: 'vertical',
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
backgroundColor: "#639851",
touchFeedback: true,
touchFeedbackColor: "#808080"
}
我尝试使用上面的代码,但我的意见/项目消失,工具栏高度被破坏:https://i.imgur.com/7rdhmQm.png – guillefix
请参阅我编辑的答案。我在我的电脑上试过了,它运行良好。感谢Nebu指出了保证金设置。 –