2016-05-10 73 views
1

我在Android上遇到了Ionic的一些問題。我認爲當我更新我的應用程序的Ionic版本時出現問題。問題是狀態欄不覆蓋web視圖。我曾嘗試在config.xml中將StatusBarOverlaysWebView首選項設置爲true,並且我嘗試調用全局StatusBar對象的不同方法,但沒有成功。我可以控制狀態欄的背景顏色和可見性,但我無法覆蓋webview。這是它看起來像現在Android Ionic Screenshot statusbarIonic無法使狀態欄覆蓋

回答

1

不幸的是,在科爾多瓦 - 插件,狀態欄is only supported by the iOS platformStatusBarOverlaysWebView方法:

StatusBar.overlaysWebView
在iOS 7,使狀態欄覆蓋或覆蓋不WebView。

StatusBar.overlaysWebView(true); 

說明
在iOS 7,設置爲false,使狀態欄出現類似的iOS 6,設置樣式和背景色,以適應使用其他功能。

支持的平臺
的iOS


這裏有一些其他的方法。檢查下面的鏈接(但它似乎並沒有工作了) http://www.martinadamko.sk/posts/translucent-bar-android-278

或者

這個怎麼樣?
要做到這一點,最簡單的方法如下:

/* ionic 2 app.ts */ 
import { Component } from '@angular/core'; 
import { Platform, ionicBootstrap } from 'ionic-angular'; 
import { StatusBar } from 'ionic-native'; 

@Component({ 
    template: '<ion-nav [root]="rootPage"></ion-nav>', 
}) 
export class App { 
    private rootPage: any; 

    constructor(private platform: Platform) { 
    this.rootPage = LandingPage; 

    platform.ready().then(() => { 
     // Okay, so the platform is ready and our plugins are available. 
     // Here you can do any higher level native things you might need. 
     StatusBar.styleDefault(); 

     // Status bar theme for android 
     if (platform.is('android')) { 
     StatusBar.styleLightContent(); 
     StatusBar.backgroundColorByHexString('#c42626'); 
     } 
    }); 
    } 
} 

的結果是這樣的: