在LinearLayout中使用android.support.v7.widget.SearchView的搜索视图

4

我需要在LinearLayout中使用SearchView,并支持API 7及以上版本。是否可以使用support-v7库来实现?这里的所有问题都是关于在actionbar中使用support-v7 searchview小部件的。有人知道如何在布局中使用它吗?谢谢。

1个回答

10
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<android.support.v7.widget.SearchView
    android:id="@+id/search"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:queryHint="@string/search_hint"
    app:iconifiedByDefault="false" />

</LinearLayout>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接