2

All, Forgive me I just began to learn development of Android, It is the first time I used the ActionBar in my Android application. Firstly. I was following the tutorial to add the resource of ActionBar to project. But the IDE alert me the resource can't be found. please help to review my current setup. thanks.

I had downloaded and upziped all the Icons. and copy all the icons under the res/drawable folder.

enter image description here

and I add a xml file named main_activity_actions.xml under the folder res/menu which content shows below.

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- Search, should appear as action button -->
    <item android:id="@+id/action_search"
          android:icon="@drawable/Core_Icons/unstyled/hdpi/ic_action_search"
          android:title="@string/action_search"
          android:showAsAction="ifRoom" />  
    <!-- Settings, should always be in the overflow -->
    <item android:id="@+id/action_settings"
          android:title="@string/action_settings"
          android:showAsAction="never" />

</menu>

Could someone please tell me why IDE can't find the icon ic_action_search.png? thanks.

ashatte
  • 5,442
  • 8
  • 39
  • 50
Joe.wang
  • 11,537
  • 25
  • 103
  • 180

1 Answers1

2

Unfortunately the resource folders do not support directory hierarchies (sub-folders), so you will need to move all icons to the parent folder (drawable).

Then reference it like this: android:icon="@drawable/ic_action_search"

https://code.google.com/p/android/issues/detail?id=2018

ashatte
  • 5,442
  • 8
  • 39
  • 50
  • No problem! It's annoying because it makes larger projects difficult to manage, but that's the way it is for now until they fix it... – ashatte Sep 25 '13 at 14:16