集switchStyle - 得到错误的资源没有发现 - 为什么? [英] Set switchStyle - get error resource not found - why?

查看:454
本文介绍了集switchStyle - 得到错误的资源没有发现 - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题: 我是一个应用程序创建一个风格,我设置:

I ran into a strange Problem: I am creating a style for an app and I set:

<item name="android:spinnerStyle">@style/CustomSpinnerAppearance</item>  
<item name="android:textViewStyle">@style/CustomTextViewAppearance</item>
<item name="android:buttonStyle">@style/CustomButton</item>  

现在我想设置:

<item name="android:switchStyle">@style/CustomSwitch</item>

和我得到这个错误。

没有资源的发现,匹配给定的名字:ATTR   '机器人:switchStyle

No resource found that matches the given name: attr 'android:switchStyle'.

我在检查API-拉特14和15(ICS)源 attrs.xml 并有:

I have checked in API-Lvl 14 and 15 (ICS) source the attrs.xml and there is:

<attr name="switchStyle" format="reference" />

为什么我不能设置尽管开关部件自定义样式,该attr为在 attrs.xml

和更为重要的是:?我有什么做的,设置自定义样式的开关小部件应用广泛

And much more important: What do I have to do, to set a custom style for the Switch widget app wide?

推荐答案

这个错误,它看起来是不可能的继承。

As per this bug, it looks like it isn't possible to inherit.

然而,作为一种解决方法,您可以覆盖现有的样式(如果它是你正在处理的只是颜色)通过在的 http://android-holo-colors.com/

However, as a workaround, you could override the existing style (if it's just colors that you're dealing with) by creating the appropriate 9-patches etc at http://android-holo-colors.com/

这篇关于集switchStyle - 得到错误的资源没有发现 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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