1

I have an options_menu.xml file like this:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/search"
      android:title="@string/search_title"
      android:icon="@drawable/ic_search"
      android:showAsAction="collapseActionView|ifRoom"
      android:actionViewClass="android.widget.SearchView" />
</menu>

When I do a project -> clean or a build, I get an error:

String types not allowed (at 'showAsAction' with value 'collapseActionView|ifRoom')

I cannot figure out what is wrong. My target SDK version is 11. Does anybody know what is causing this?

Thanks, Igor

1
  • I should also add that I get an error like this: "W/ResourceType( 5436): Bad XML block: no root element node found" Commented Mar 27, 2012 at 13:53

2 Answers 2

5

Remove collapseActionView It is introduced from Api Level 14 and your level is 11.Remove it try.hope it will work.

Here you can check it.

Sign up to request clarification or add additional context in comments.

Comments

1

I solved my own issue. According to the docs, collapseActionView was introduced in API level 14. So I just had to change my target SDK version. More here: Menu Resource

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.