commonroutesServer/www/plugins/cordova-plugin-statusbar/doc/zh/README.md
www/plugins/cordova-plugin-statusbar/doc/zh/README.mdRaw
1<!---
2# license: Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18-->
19
20# cordova-plugin-statusbar
21
22[](https://travis-ci.org/apache/cordova-plugin-statusbar)
23
24# StatusBar
25
26> `StatusBar`物件提供了一些功能,自訂的 iOS 和 Android 狀態列。
27
28## 安裝
29
30 cordova plugin add cordova-plugin-statusbar
31
32
33## 首選項
34
35#### config.xml
36
37 * **StatusBarOverlaysWebView**(布林值,預設值為 true)。在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖在啟動時。
38
39 <preference name="StatusBarOverlaysWebView" value="true" />
40
41
42 * **StatusBarBackgroundColor**(顏色十六進位字串,預設值為 #000000)。IOS 7 和 Android 5,由十六進位字串 (#RRGGBB) 在啟動時設置狀態列的背景色。
43
44 <preference name="StatusBarBackgroundColor" value="#000000" />
45
46
47 * **狀態列**(狀態列樣式,預設值為 lightcontent)。在 iOS 7,設置的狀態橫條圖樣式。可用的選項預設,lightcontent,blacktranslucent,blackopaque。
48
49 <preference name="StatusBarStyle" value="lightcontent" />
50
51
52### Android 的怪癖
53
54Android 的 5 + 準則指定使用不同的顏色比您主要的應用程式狀態欄顏色 (不像很多 iOS 7 + 應用程式的統一狀態列顏色),所以你可能想要設置在運行時顯示狀態列顏色而不是通過`StatusBar.backgroundColorByHexString`或`StatusBar.backgroundColorByName`。 一個的方式做到這一點將是:
55
56```js
57if (cordova.platformId == 'android') {
58 StatusBar.backgroundColorByHexString("#333");
59}
60```
61
62## 在啟動時隱藏
63
64在運行時期間,你可以使用 StatusBar.hide 函數下面,但如果你想要顯示狀態列隱藏在應用程式啟動時,你必須修改你的應用程式的 Info.plist 檔。
65
66添加編輯這兩個屬性,如果不存在。 將**"狀態列最初隱藏"**設置為**"YES"**和**"視圖基於控制器的狀態列外觀"**設置為**"否"**。 如果您手動編輯它沒有 Xcode,鍵和值是:
67
68 <key>UIStatusBarHidden</key>
69 <true/>
70 <key>UIViewControllerBasedStatusBarAppearance</key>
71 <false/>
72
73
74## 方法
75
76這個外掛程式定義全域 `StatusBar` 物件。
77
78雖然在全球範圍內,它不可用直到 `deviceready` 事件之後。
79
80 document.addEventListener("deviceready", onDeviceReady, false);
81 function onDeviceReady() {
82 console.log(StatusBar);
83 }
84
85
86 * StatusBar.overlaysWebView
87 * StatusBar.styleDefault
88 * StatusBar.styleLightContent
89 * StatusBar.styleBlackTranslucent
90 * StatusBar.styleBlackOpaque
91 * StatusBar.backgroundColorByName
92 * StatusBar.backgroundColorByHexString
93 * StatusBar.hide
94 * StatusBar.show
95
96## 屬性
97
98 * StatusBar.isVisible
99
100## 許可權
101
102#### config.xml
103
104 <feature name="StatusBar">
105 <param name="ios-package" value="CDVStatusBar" onload="true" />
106 </feature>
107
108
109# StatusBar.overlaysWebView
110
111在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖。
112
113 StatusBar.overlaysWebView(true);
114
115
116## 說明
117
118在 iOS 7,設置為 false,使狀態列出現像 iOS 6。設置樣式和背景顏色,適合使用其他函數。
119
120## 支援的平臺
121
122 * iOS
123
124## 快速的示例
125
126 StatusBar.overlaysWebView(true);
127 StatusBar.overlaysWebView(false);
128
129
130# StatusBar.styleDefault
131
132使用預設狀態列 (淺色背景深色文本)。
133
134 StatusBar.styleDefault();
135
136
137## 支援的平臺
138
139 * iOS
140 * Windows Phone 7
141 * Windows Phone 8
142 * Windows Phone 8.1
143
144# StatusBar.styleLightContent
145
146使用 lightContent 狀態列 (深色背景光文本)。
147
148 StatusBar.styleLightContent();
149
150
151## 支援的平臺
152
153 * iOS
154 * Windows Phone 7
155 * Windows Phone 8
156 * Windows Phone 8.1
157
158# StatusBar.styleBlackTranslucent
159
160使用 blackTranslucent 狀態列 (深色背景光文本)。
161
162 StatusBar.styleBlackTranslucent();
163
164
165## 支援的平臺
166
167 * iOS
168 * Windows Phone 7
169 * Windows Phone 8
170 * Windows Phone 8.1
171
172# StatusBar.styleBlackOpaque
173
174使用 blackOpaque 狀態列 (深色背景光文本)。
175
176 StatusBar.styleBlackOpaque();
177
178
179## 支援的平臺
180
181 * iOS
182 * Windows Phone 7
183 * Windows Phone 8
184 * Windows Phone 8.1
185
186# StatusBar.backgroundColorByName
187
188在 iOS 7,當您將 StatusBar.statusBarOverlaysWebView 設置為 false,你可以設置狀態列的背景色的顏色名稱。
189
190 StatusBar.backgroundColorByName("red");
191
192
193支援的顏色名稱是:
194
195 black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
196
197
198## 支援的平臺
199
200 * iOS
201 * Android 5+
202 * Windows Phone 7
203 * Windows Phone 8
204 * Windows Phone 8.1
205
206# StatusBar.backgroundColorByHexString
207
208由十六進位字串設置狀態列的背景色。
209
210 StatusBar.backgroundColorByHexString("#C0C0C0");
211
212
213此外支援 CSS 速記屬性。
214
215 StatusBar.backgroundColorByHexString("#333"); // => #333333
216 StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB
217
218
219在 iOS 7,當將 StatusBar.statusBarOverlaysWebView 設置為 false,您可以設置狀態列的背景色由十六進位字串 (#RRGGBB)。
220
221WP7 和 WP8 您還可以指定值為 #AARRGGBB,其中 AA 是 Alpha 值
222
223## 支援的平臺
224
225 * iOS
226 * Android 5+
227 * Windows Phone 7
228 * Windows Phone 8
229 * Windows Phone 8.1
230
231# StatusBar.hide
232
233隱藏狀態列。
234
235 StatusBar.hide();
236
237
238## 支援的平臺
239
240 * iOS
241 * Android 系統
242 * Windows Phone 7
243 * Windows Phone 8
244 * Windows Phone 8.1
245
246# StatusBar.show
247
248顯示狀態列。
249
250 StatusBar.show();
251
252
253## 支援的平臺
254
255 * iOS
256 * Android 系統
257 * Windows Phone 7
258 * Windows Phone 8
259 * Windows Phone 8.1
260
261# StatusBar.isVisible
262
263讀取此屬性,以查看狀態列是否可見。
264
265 if (StatusBar.isVisible) {
266 // do something
267 }
268
269
270## 支援的平臺
271
272 * iOS
273 * Android 系統
274 * Windows Phone 7
275 * Windows Phone 8
276 * Windows Phone 8.1