简体   繁体   English

Galaxy Nexus上的Android Theme.Holo.Light在模拟器没有的时候有灰色背景

[英]Android Theme.Holo.Light on Galaxy Nexus has grey background when emulator does not

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). 当我使用主题Theme.Holo.Light时,我的窗口背景在模拟器上显示为白色(与使用早期Android版本的Theme.Light相同)。 However on the Galaxy Nexus it appears as a light grey. 然而在Galaxy Nexus上它显得浅灰色。 I've taken a screenshot and found it is actually a very slight gradient. 我拍了一张截图,发现它实际上是一个非常轻微的渐变。

Here is a brand new project created with ADT16. 这是一个用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) . 这是运行API 15的模拟器的屏幕截图(在API 14上是相同的)

Here it is on a real Galaxy Nexus. 这是一个真正的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). 我知道不要相信制造商不要在旧的Android版本上弄乱AOSP主题,但是(i)这是一个Nexus设备和(ii)Holo应该是强制性的,并且在所有设备上都没有修改(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.) (也许有人使用除Galaxy Nexus之外的ICS设备可以告诉我他们为Holo.Light获得了什么 - 也许这是一个模拟器错误。)

Theme.Holo.Light does have a grey background. Theme.Holo.Light确实有灰色背景。

The screenshot from your Nexus shows the right behaviour. 来自Nexus的屏幕截图显示了正确的行为。

Best wishes, Tim 祝愿,蒂姆

在你的主题中使用它

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 机器人:主题=“@风格/ Theme.Holo.Light” - android:theme=“@style/Theme.Holo.Light" 覆盖Theme.Holo.Light的背景颜色 - Overriding background color of Theme.Holo.Light 找不到匹配给定名称'android:Theme.Holo.Light'的资源 - No resource found that matches the given name 'android:Theme.Holo.Light' 使用“android:Theme.Holo.Light”时如何更改焦点EditText的颜色? - How to change the color of a focused EditText when using “android:Theme.Holo.Light”? 具有NoTitleBar Theme.Holo.Light的ActionBar - ActionBar with NoTitleBar Theme.Holo.Light 在Theme.Holo.Light上使用Theme.Light Datepicker - Use Theme.Light Datepicker on Theme.Holo.Light 动作栏中没有AppCompatActivity且带有android:Theme.Holo.Light主题的图像 - Image in Action bar without AppCompatActivity and with android:Theme.Holo.Light theme 无法更改 Theme.Holo.Light 操作栏的背景颜色 - Can't change background color of Theme.Holo.Light action bar 如何在默认主题Theme.Holo.Light中更改homeAsUpIndicator的图像 - How to change image of homeAsUpIndicator in default theme Theme.Holo.Light 键入错误:检索项目的父项时出错:未找到与给定名称&#39;android:Theme.Holo.Light&#39;相匹配的资源。 - Type error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM