当模拟器没有时,Galaxy Nexus 上的 Android Theme.Holo.Light 具有灰色背景

发布于 2025-01-08 03:30:48 字数 1034 浏览 2 评论 0原文

当我使用主题 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 相同)

这是在真实的 Galaxy Nexus 上。

为什么有区别?我知道不要相信制造商不会在旧版 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

疯狂的代价 2025-01-15 03:30:48

Theme.Holo.Light 确实有灰色背景。

Nexus 的屏幕截图显示了正确的行为。

最好的祝愿,
蒂姆

Theme.Holo.Light does have a grey background.

The screenshot from your Nexus shows the right behaviour.

Best wishes,
Tim

可是我不能没有你 2025-01-15 03:30:48

在你的主题中使用它

<item name="android:windowBackground">@color/your_color</item>

use this in your theme

<item name="android:windowBackground">@color/your_color</item>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文