首页 文章

NativeScript中的ActionBar背景图像?

提问于
浏览
1

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

我知道你可以改变背景颜色,但是我无法显示背景图像 .

我知道你可以在原生iOS中做到这一点,我也确信在Android中,如何在中完成?我已经检查了NS文档,但它在实际的背景图像上没有任何内容,只显示图像本身 .

1 回答

  • 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";
      }
    }
    

    this one worked for me

相关问题