简体   繁体   English

Android:使用默认样式

[英]Android: Using default styles

<style name="test" parent="@android:style/WindowTitle"></style>

Whenever I type the above, I get the following error message from eclipse: 每当我键入上面的内容时,我都会从eclipse中收到以下错误消息:

Description
Resource Path Location Type

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/WindowTitle'.
styles.xml  /alertdialogapp/res/values  line 3  Android AAPT Problem

The same error also appears when I use the style @android:style/AlertDialog 当我使用样式@android:style/AlertDialog时,也会出现相同的错误

WindowTitle and AlertDialog are private styles in the platform and you cannot reference them. WindowTitleAlertDialog是平台中的私有样式,您无法引用它们。

Some ancient versions of aapt had a bug which allowed you to reference private styles but it's been fixed a long time ago. aapt的一些古老版本有一个错误,允许你引用私人风格,但很久以前它已被修复。 Private style resource identifiers are not guaranteed to stay the same across platform builds, so even if you managed to dig up the resource identifier somewhere, it would likely break at some point. 私有样式资源标识符不保证在平台构建中保持不变,因此即使您设法在某处挖掘资源标识符,它也可能在某个时刻中断。

If you need to extend a particular private platform theme, copy the style definitions you need from platform sources to your own project. 如果需要扩展特定的私有平台主题,请将平台源所需的样式定义复制到您自己的项目中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM