如何检查在Android的状态栏的颜色? [英] How can I check the status bar colour in Android?

查看:197
本文介绍了如何检查在Android的状态栏的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查在Android的状态栏的颜色?

How can I check the status bar colour in Android?

为什么我需要检查吗?我创建了我的状态栏图标按设计准则然而一些的设备(三星Galaxy S)状态栏是黑色的,它运行的是Android 2.1。

Why do I need to check this? I have created my status bar icons as per the design guidelines however on some devices (Samsung Galaxy S) the status bar is black and it is running Android 2.1.

状态栏图标的建议,看看在Android 2.3(的Nexus S)和仿真器(早期的Andr​​oid 2.1)使用默认的浅灰色状态栏内大。但是被推荐为$ P $,黑图标P-2.3别看在三星Galaxy S清晰。

The recommendations for the status bar icons look great on Android 2.3 (Nexus S) and within the emulator (earlier Android 2.1) with the default light grey status bar. However the black icons that are recommended for pre-2.3 don't look clear on the Samsung Galaxy S.

我想提供一个白色的图标,如果在Android运行的是2.1或2.2采用了黑色的状态栏。

I would like to provide a white icon if the Android is running 2.1 or 2.2 with a black status bar.

基本上,问题是,Android设计准则并不真正覆盖变化,如三星Galaxy S.例如用户界面的三星Galaxy S运行Android 2.1应该有一个浅灰色状态栏上的手机,但它有一个黑色的一。这不适合以及与谷歌的提供设计指南。

Basically the problem is that the Android design guidelines don't really cover the phones that changed the UI like the Samsung Galaxy S. For example the Samsung Galaxy S running Android 2.1 should have a light grey status bar but it has a black one. This doesn't fit in well with Google's provided design guidelines.

推荐答案

通常你想通过清单文件绑定这一点,但有一种方法来获取值:
使用Build.VERSION.SDK_INT,并检查它反对Build.VERSION_ codeS,
http://developer.android.com/reference/android/os/Build .VERSION.html

Usually you are suppose to bind this via the manifest file but there is a way to get the value: Use the Build.VERSION.SDK_INT and check it against the Build.VERSION_CODES, http://developer.android.com/reference/android/os/Build.VERSION.html

您可以从Android开发博客文章的这里

you can get the more interesting read from an android dev blog post here

- 编辑 -

您必须弄清楚你 BUILD 但不要忘了人有主题,以及...

You will have to figure out what device you are on from BUILD but don't forget people have themes as well...

短揪的框架和状态栏的应用程序,那将是最好的... <一个href=\"http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/2.3_r1/com/android/systemui/statusbar/StatusBarService.java#StatusBarService.onCreate%28%29\"相对=nofollow>这里是一个链接如果你想尝试挖掘到状态栏,并从得到它的原始Framework.jar ...

Short of ripping up the framework and the status bar app, that is going to be the best... here is a link if you want to try digging into the StatusBar and getting it from the raw Framework.jar...

下面是一个人谁提到他处理如何与玩链接状态栏。

Here is a link to a guy who mentions how he handled playing with the status bar.

这篇关于如何检查在Android的状态栏的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆