【发布时间】:2011-04-26 15:03:35
【问题描述】:
我正在尝试自定义微调器。我找到了这个教程,http://www.gersic.com/blog.php?id=57 它看起来不错,但我发现了一些错误,所有这些都如下所示
error: No resource identifier found for attribute 'state_dropdown_showing' in package 'android'
导致此错误的 xml 是
<!-- DROPDOWN SHOWING-->
<item android:state_first="true"
android:state_dropdown_showing="true"
android:drawable="@drawable/btn_dropdown_down"
/>
<item android:state_middle="true"
android:state_dropdown_showing="true"
android:drawable="@drawable/btn_dropdown_up_down"
/>
<item android:state_last="true"
android:state_dropdown_showing="true"
android:drawable="@drawable/btn_dropdown_up"
/>
<item android:state_single="true"
android:state_dropdown_showing="true"
android:drawable="@drawable/btn_dropdown_neither_up_down"
/>
<!-- DROPDOWN NOT SHOWING-->
<item android:state_first="true"
android:state_dropdown_showing="false"
android:drawable="@drawable/btn_dropdown_right_only"
/>
<item android:state_middle="true"
android:state_dropdown_showing="false"
android:drawable="@drawable/btn_dropdown_left_right_collapsed"
/>
<item android:state_last="true"
android:state_dropdown_showing="false"
android:drawable="@drawable/btn_dropdown_left_only"
/>
<item android:state_single="true"
android:state_dropdown_showing="false"
android:drawable="@drawable/btn_dropdown_neither"
/>
而且我在网上找不到与此相关的任何内容。我现在正处于修复状态。我想用漂亮的颜色背景改变常规微调器的外观。
请任何人指导我关于微调器的自定义。
【问题讨论】:
-
@Shaista:你确定所有的按钮drawable和xml文件都在/res/drawable目录下吗?还要确保名称匹配(记住区分大小写等)。
-
是的,我已经设置好了,如果有问题,他们会得到相应的错误。当我删除 android:state_dropdown_showing 然后没有错误。所以问题出在 android:state_dropdown_showing 因为错误也说同样的事情:-(
-
@Shaista:我自己试过这个,我得到了完全相同的错误。奇怪的是,当前的 android.R.attr 的 Android 文档没有提到 state_dropdown_showing 属性,尽管如果你用谷歌搜索它,有各种参考资料。我什至尝试将 Eclipse 更新到最新的 ADT 版本以及所有最新的 Android SDK 内容,但仍然无法识别。
-
是的,Squonk 先生。你说的对。我想我将不得不采取另一种方法。我想知道教程也没有给出任何提示,当然 SDK 至少应该已经更新了。但是谢谢,你为我付出了努力。
-
@Shaista Naaz:祝你好运,对不起,我无法提供更多帮助。我看看能不能找到答案。
标签: android customization spinner