我試圖更改狀態欄的顏色以匹配頁面背景色的其餘部分,並且它似乎無法正常工作。如何使用NativeScript更改iOS和Android中狀態欄的顏色
下面是我home.css是什麼樣子
Page {
background-color: #5497CB;
color:#ecf0f1;
}
這裏是我的home.js看起來像
var frameModule = require("ui/frame");
exports.loaded = function(args) {
var page = args.object;
var iosFrame = frameModule.topmost().ios;
if (iosFrame) {
iosFrame.navBarVisibility = 'never';
}
};
而且最後這裏是我的home.xml
<Page loaded="loaded">
<StackLayout orientation="vertical">
<TextField id="email_address" text="{{ email }}" hint="Email Address" keyboardType="email" />
<TextField secure="true" text="{{ password }}" hint="Password" />
<Button text="Sign in" tap="signIn"/>
<Button text="Sign up for Groceries" cssClass="link" tap="register"/>
</StackLayout>
</Page>
正如你看不到任何複雜的東西,只是試圖讓狀態欄顏色有一個白色的字體和相同的背景色!
任何指針?
這將成爲NativeScript 1.5.0的一部分。在此版本發佈之前,您可以跟上這個問題的討論[https://github.com/NativeScript/NativeScript/issues/767]。 –
@NeliChakarova我正在嘗試關注此鏈接http://developer.telerik.com/featured/customizing-ios-navigation-bar-status-bar-nativescript/,但很高興知道它將在1.5版中推出! – BaconJuice
我想設置頁面背景顏色和狀態欄不繼承顏色。我將Page.backgroundSpanUnderStatusBarProperty設置爲true,沒有任何反應。仍然得到一個灰色的狀態欄(我試圖將其設置爲紅色)。難道我做錯了什麼? –