You are reading docs for v1.3.1, click here for the latest version.
ActionBar

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 - это абстракция NativeScript для Android ActionBar и iOS NavigationBar.


Использование заголовка

<ActionBar title="MyApp" />

Использование пользовательского представления для заголовка

<ActionBar>
  <StackLayout orientation="horizontal">
    <Image src="res://icon" width="40" height="40" verticalAlignment="center" />
    <Label text="ativeScript" fontSize="24" verticalAlignment="center" />
  </StackLayout>
</ActionBar>

Настройка иконки приложения для Android

<ActionBar title="My App" android.icon="res://icon" android.iconVisibility="always" />

Удаление рамок

На iOS и Android внизу ActionBar рисуется маленькая рамка. Кроме того, цвет фона ActionBar на iOS немного отличается от того, что вы указываете, потому что iOS применяет фильтр. Чтобы удалить этот фильтр и рамку, установите свойство flat в значение true.

<ActionBar title="My App" flat="true" />

Свойства

НазваниеТипОписание
titleStringЗаголовок, отображаемый в ActionBar.
android.iconStringИконка, отображаемая на Android.
android.iconVisibilityStringУстанавливается, когда иконка видима.
flatbooleanУдаляет рамку и цвет фильтра на iOS. Значение по умолчанию - false.
Contributors