android - SearchView in Actionbar Appcompat -
in application, using theme.appcompat.light.darkactionbar
facing weird problem. have created searchview
in actionbar
, has set property app:showasaction="collapseactionview|ifroom"
but searchview not expanded or collapsed on touch.
menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/search" android:title="@string/search" android:icon="@android:drawable/ic_menu_search" app:showasaction="collapseactionview|ifroom" android:actionviewclass="android.support.v7.widget.searchview" /> </menu>
i have tried different solutions none worked. idea?
try change
android:actionviewclass="android.support.v7.widget.searchview"
by
app:actionviewclass="android.support.v7.widget.searchview"
this worked me
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.ipartie.views.activities.homeactivity"> <item android:id="@+id/search" android:title="@string/search" android:icon="@drawable/abc_ic_search_api_mtrl_alpha" app:showasaction="always" app:actionviewclass="android.support.v7.widget.searchview"/> </menu>
Comments
Post a Comment