如何在API

时间:2022-07-18 22:48:08

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.

所以我下载了支持库v7:22.2.1。我试图在XML文件中创建一个简单的搜索视图,但当然我得到错误View需要API级别11(当前最小值为10):.我在网上读到你需要使用支持库才能使用最小API设置为11的搜索视图。我已经下载并在build.gradle文件中进行设置。

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

我不明白如何在XML文件中实现支持库以使用SearchView小部件。

1 个解决方案

#1


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.

如果您看到http://developer.android.com/reference/android/widget/SearchView.html,您会注意到有效需要API级别11.请参阅此答案以获取更多详细信息。

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

您将不得不使用支持v7库:https://developer.android.com/reference/android/support/v7/widget/SearchView.html

Here's how it should look the XML:

以下是它应该如何看待XML:

<android.support.v7.widget.SearchView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        .... more attributes
         />

#1


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.

如果您看到http://developer.android.com/reference/android/widget/SearchView.html,您会注意到有效需要API级别11.请参阅此答案以获取更多详细信息。

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

您将不得不使用支持v7库:https://developer.android.com/reference/android/support/v7/widget/SearchView.html

Here's how it should look the XML:

以下是它应该如何看待XML:

<android.support.v7.widget.SearchView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        .... more attributes
         />