所以我已经下载了支持库v7:22.2.1。我试图在一个XML文件中创建一个简单的搜索视图,但是我当然得到了错误的view requires API level 11 (当前最小值是10):。我在网上读到,你需要使用支持库才能使用搜索视图,其中min设置为低于11。我已经下载了它,并将其设置在build.gradle文件中。
我不知道如何在XML文件中实现support库才能使用SearchView小部件。
发布于 2015-07-25 05:23:17
如果你看到这个http://developer.android.com/reference/android/widget/SearchView.html,你会注意到它实际上需要API级别11。请参考这个answer了解更多详细信息。
您必须使用support v7库:https://developer.android.com/reference/android/support/v7/widget/SearchView.html
下面是它在XML中的样子:
<android.support.v7.widget.SearchView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
.... more attributes
/>https://stackoverflow.com/questions/31619637
复制相似问题