当模拟器没有时,Galaxy Nexus 上的 Android Theme.Holo.Light 具有灰色背景
当我使用主题 Theme.Holo.Light 时,我的窗口背景在模拟器上显示为白色(与使用早期 Android 版本中的 Theme.Light 相同)。但在 Galaxy Nexus 上,它显示为浅灰色。我拍了一张截图,发现它实际上是一个非常轻微的渐变。
这是一个用 ADT16 创建的全新项目。我所做的就是在清单中设置主题:
android:theme="@android:style/Theme.Holo.Light"
为了对比,将其放入活动中:
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This text background is white"
android:textAppearance="?android:attr/textAppearanceLarge"
android:background="#fff" />
这是来自的屏幕截图运行 API 15 的模拟器(与 API 14 相同)。
为什么有区别?我知道不要相信制造商不会在旧版 Android 版本上搞乱 AOSP 主题,但是 (i) 这是 Nexus 设备,并且 (ii) Holo 在所有具有 Market (http://android) 的设备上应该是强制性的且未经修改-developers.blogspot.co.nz/2012/01/holo-everywhere.html)。
(也许拥有 Galaxy Nexus 以外的 ICS 设备的人可以告诉我他们从 Holo.Light 得到了什么 - 也许这是一个模拟器错误。)
When I use the theme Theme.Holo.Light, my window background appears white on the emulator (same as using Theme.Light from earlier Android versions). However on the Galaxy Nexus it appears as a light grey. I've taken a screenshot and found it is actually a very slight gradient.
Here is a brand new project created with ADT16. All I have done is set the theme in the manifest:
android:theme="@android:style/Theme.Holo.Light"
and for contrast put this in the activity:
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This text background is white"
android:textAppearance="?android:attr/textAppearanceLarge"
android:background="#fff" />
Here's the screenshot from the emulator running API 15 (and is identical on API 14).
Here it is on a real Galaxy Nexus.
Why the difference? I know not to trust manufacturers not to mess with the AOSP themes on older Android versions, but (i) this is a Nexus device and (ii) Holo is supposed to be mandatory and unmodified on all devices with Market (http://android-developers.blogspot.co.nz/2012/01/holo-everywhere.html).
(Perhaps someone with an ICS device other than Galaxy Nexus can tell me what they get for Holo.Light - maybe it is an emulator bug.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Theme.Holo.Light 确实有灰色背景。
Nexus 的屏幕截图显示了正确的行为。
最好的祝愿,
蒂姆
Theme.Holo.Light does have a grey background.
The screenshot from your Nexus shows the right behaviour.
Best wishes,
Tim
在你的主题中使用它
use this in your theme