安卓:使用默认样式样式

2023-09-04 23:39:45 作者:琴断ら弦奈何

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

当我输入上面,我从日食出现以下错误信息:

Whenever I type the above, I get the following error message from 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

同样的错误还出现在我使用的样式 @android:款式/ AlertDialog

推荐答案

WINDOWTITLE AlertDialog 在私人风格这个平台,你不能引用他们。

WindowTitle and AlertDialog are private styles in the platform and you cannot reference them.

一些古老的版本AAPT的有这让你引用的私人风格的一个错误,但它被固定在很久以前。私人样式资源标识符不能保证保持不变跨平台的建立,所以即使你设法挖掘资源标识符的地方,它可能会在某个时候突破。

Some ancient versions of aapt had a bug which allowed you to reference private styles but it's been fixed a long time ago. 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.

 
精彩推荐
图片推荐