android - How to detect if SearchView is expanded? -


i have menu items like:

<item     android:id="@+id/action_search"     android:title="search"     app:actionviewclass="android.support.v7.widget.searchview"     app:showasaction="always"/>  @override public boolean oncreateoptionsmenu( menu menu ) {   getmenuinflater().inflate( r.menu.passenger, menu );   searchitem = menu.finditem( r.id.action_search );   searchview = (searchview)menuitemcompat.getactionview( searchitem );   searchview.setsubmitbuttonenabled( false );   return super.oncreateoptionsmenu( menu ); } 

i want check if searchview expanded.

i tried searchitem.isactionviewexpanded() , searchview.ishovered() none of them worked.

what missing?

tia

try searchitem.isiconified()

returns current iconified state of searchview.

returns

true if searchview iconified, false if search field visible.

http://developer.android.com/reference/android/widget/searchview.html#isiconified%28%29


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -