[英]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.