This is an overview of the most common usage of ActionBar. For more information about the available properties, methods, or events, head over to the complete API documentation for ActionBar.
ActionBar组件是Android ActionBar和iOS NavigationBar的NativeScript抽象。
<ActionBar title="MyApp" />
<ActionBar>
<StackLayout orientation="horizontal">
<Image src="res://icon" width="40" height="40" verticalAlignment="center" />
<Label text="NativeScript" fontSize="24" verticalAlignment="center" />
</StackLayout>
</ActionBar>
<ActionBar title="My App" android.icon="res://icon" android.iconVisibility="always" />
在iOS和Android上,在ActionBar的底部绘制了一个小边框。此外,iOS上ActionBar的背景颜色与您指定的略有不同,因为iOS应用了过滤器。要删除此过滤器和边框,请设置 flat
为 true
。
<ActionBar title="My App" flat="true" />
名称 | 类型 | 描述 |
---|---|---|
title | String | 要在ActionBar中显示的标题。 |
android.icon | String | Android上显示的图标。 |
android.iconVisibility | String | 设置图标可见时的设置。 |
flat | boolean | 删除边框和iOS颜色过滤器。默认 false 。 |