嗨,我想将searchview放在活动中并在片段中使用它,但是我不想使用actionbar或工具栏,这就是我写的 这是activity.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
...
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:background="@color/colorPrimaryLight">
<android.support.design.widget.TabLayout
...
<android.support.v7.widget.SearchView
android:layoutDirection="rtl"
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.SearchView>
</RelativeLayout>
<android.support.v4.view.ViewPager
...
</android.support.design.widget.CoordinatorLayout>
所以我的问题是如何处理片段搜索?