1

So I have downloaded the support library v7:22.2.1. I am trying to create a simple search view in a XML file but of course I get the error View requires API level 11 (current min is 10): . I read online that you need to use the support library in order to use search view where the min API is set to under 11. I have downloaded it and set it up in the build.gradle file.

I don't understand how to implement the support library in the XML file in order to use the SearchView widget.

BaBazinga
  • 159
  • 1
  • 13

1 Answers1

0

If you see the http://developer.android.com/reference/android/widget/SearchView.html you will noticed that effectively requires API Level 11. Please refer to this answer for further details.

You will have to use the support v7 library: https://developer.android.com/reference/android/support/v7/widget/SearchView.html

Here's how it should look the XML:

<android.support.v7.widget.SearchView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        .... more attributes
         />
Community
  • 1
  • 1
moxi
  • 1,390
  • 20
  • 21
  • I understand I have to use support v7 library. I downloaded it and have it set up in the build.gradle but how do i tell the XML file to use that library? – BaBazinga Jul 25 '15 at 03:18