安卓:使用默认样式 [英] Android: Using default styles

查看:127
本文介绍了安卓:使用默认样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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.

如果您需要扩展一个特定的私人平台的主题,复制从<一个需要的样式定义href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml"相对=nofollow>平台源以自己的项目。

If you need to extend a particular private platform theme, copy the style definitions you need from platform sources to your own project.

这篇关于安卓:使用默认样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆