I am new to Android Development. I was just following the basic turorial on developer.android.com
to create my first application.
As I was creating the Action BAr, I had to add this Search button to it. I created the menu xml and this is what I had written on it.
<!-- Search, should appear as action button --> <item android:id="@+id/action_search" android:icon="@drawable/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" />
Now my question is on this part of the XML
android:icon="@drawable/ic_action_search"
I get a compilation error in eclipse, which says,
error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_action_search').
I checked on developer.android.com and also googled it out, but I'm just not able to locate a solution.
I need to solve this problem. As always, I am able to skip this part of the XML and what I get is just plain text "SEARCH", but the icon will definitely look better.
Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import. Figure 3: Select Import Drawables from the dropdown menu.
Here is the easy way if you're using Eclipse:
Eclipse will automatically populate the res/drawable-* directories with the new icon, scaled to the directory size. No need to download anything, understand PNG or copy the icon into multiple directories.
I use the file wizard A LOT.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With