NativeScript中的ActionBar背景图像?

时间:2017-03-08 10:44:20

标签: nativescript angular2-nativescript

是否可以在NativeScript中设置ActionBar的background-image属性?

我知道您可以更改背景颜色,但我无法显示背景图片。

我知道您可以在原生iOS中执行此操作,我也确定在Android中,如何在{NS}中完成? 我已经检查了NS文档但它在实际背景图像上没有任何内容,只显示图像本身。

1 个答案:

答案 0 :(得分:0)

import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { Page } from 'ui/page';

@Component({
  selector: 'home',
  templateUrl: 'modules/home/home.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class HomeComponent {
  constructor(private page : Page){

  }
  ngOnInit() {
    this.page.actionBar.backgroundImage = "res://actionbar_bg";
  }
}

这个对我有用