0

In my app i finally decided to get rid of ActionBarSherlock. In order to do that i had to fix some of my styles. When compiling app with styles like this:

<style name="Theme.MyApp" parent="@android:style/Theme.Holo">
   <item name="android:actionDropDownStyle">@style/MyAppDropDownStyle</item>
</style>

<style name="MyAppDropDownStyle" parent="@android:style/Widget.Holo.Spinner.DropDown.ActionBar">
   <item name="android:popupBackground">@color/my_color</item>
</style>

IntelliJ Idea throws error Error:(50, -1) android-apt-compiler: [MyApp] C:\SLI\Repo\Android\MyApp\res\values\themes.xml:50: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Widget.Holo.Spinner.DropDown.ActionBar'.. IntelliJ can find this resource by "Go to > declaration" option. Any idea how to fix this error? Thanks in advance.

Seblis
  • 339
  • 4
  • 17
  • What is your build target? 11 or 13? – Dr.jacky Feb 09 '15 at 12:18
  • minSdkVersion is 14, target 20. – Seblis Feb 09 '15 at 12:20
  • if the solution on this link is your answer, tell me, to put it as answer: http://stackoverflow.com/questions/13726018/adding-holo-theme-to-2-3-6-error-using-holoeverywhere – Dr.jacky Feb 09 '15 at 12:23
  • Unfortunately this link doesn't solve my problem. Missing resource isn't related to any third-party library. They are included in a standard android styles.xml file. Moreover other styles from the same file are linked the same way and they don't cause the error. – Seblis Feb 09 '15 at 12:35
  • please do it, and tell me: Project(Right Click)--> Android Tools --> Add Support Library / Fix Project Property. – Dr.jacky Feb 09 '15 at 12:43
  • I assume this option is available only under Eclipse? I am using IntelliJ Idea. – Seblis Feb 09 '15 at 12:49
  • Please set second parent to this: Widget.Sherlock.Spinner.DropDown.ActionBar – Dr.jacky Feb 09 '15 at 13:07

1 Answers1

0

It appears @android:style/Widget.Holo.Spinner.DropDown.ActionBar is private and I couldn't use it in inheritance. Displayed error was somewhat misleading - it told that resource wasn't found at all. I found last public ancestor of this style and filled it with required information, so the solution looks like this:

<style name="Theme.MyApp" parent="@android:style/Theme.Holo">
   <item name="android:actionDropDownStyle">@style/MyAppDropDownStyle</item>
</style>

<style name="MyAppDropDownStyle" parent="@android:style/Widget.Holo.Spinner">
   <item name="android:popupBackground">@color/my_color</item>
</style>

It's really simple, but relatively hard to find.

Seblis
  • 339
  • 4
  • 17