Android Searchview - 单击搜索菜单图标时显示以下操作的第二个搜索输入

时间:2016-10-04 18:00:07

标签: android searchview

我在工具栏中有一个实现android.support.v7.widget.SearchView的应用程序。我刚刚将v7支持库更新为24.2.0(可能相关?),在Android 22或更高版本设备映像的操作栏下方显示了辅助搜索输入。有关导致此问题的原因以及如何删除它的任何想法?

Screenshot of the issue

这是我的菜单项定义



    <item
        android:id="@+id/action_search"
        android:icon="@android:drawable/ic_menu_search"
        android:title="@string/webview_action_search"
        android:iconifiedByDefault="true"
        app:actionViewClass="android.support.v7.widget.SearchView"
        app:showAsAction="always" />
&#13;
&#13;
&#13;

以下是我的主要活动的布局:

&#13;
&#13;
<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:orientation="vertical">
    <!-- Toolbar -->
    <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/wikihow_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize">

        <ImageView
            android:id="@+id/wikihow_toolbar_logo"
            android:layout_width="115dp"
            android:layout_height="20dp"
            android:layout_gravity="center"
            android:src="@drawable/wikihow_logo" />

        <TextView
            android:id="@+id/wikihow_toolbar_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text=""
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/text_color_title" />

    </android.support.v7.widget.Toolbar>

    <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

        <!-- As the main content view, the view below consumes the entire
             space available using match_parent in both dimensions. -->
        <FrameLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <!-- android:layout_gravity="start" tells DrawerLayout to treat
             this as a sliding drawer on the left side for left-to-right
             languages and on the right side for right-to-left languages.
             If you're not building against API 17 or higher, use
             android:layout_gravity="left" instead. -->
        <!-- The drawer is given a fixed width in dp and extends the full height of
             the container. -->
        <fragment
            android:id="@+id/navigation_drawer"
            android:name="com.wikihow.wikihowapp.fragments.NavigationDrawerFragment"
            android:layout_width="@dimen/navigation_drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            tools:layout="@layout/navigation_drawer_fragment" />

    </android.support.v4.widget.DrawerLayout>
</LinearLayout>
&#13;
&#13;
&#13;

0 个答案:

没有答案