Search Widget doesn't open action view in ActionBar Android -


i trying achieve uniform action bar across app. trying add search widget. app displays magnifying glass, icon, , overflow menu icon in actionbar.

i haven't yet added search functionality trying icon display how want it.

the problem have on launch page magnifying glass displayed, , if clicked field entering search term appears.

if user goes activity magnifying glass still appear in action bar if clicked nothing happen. difference other activities display "up" arrow left of android logo in action bar don't think reason search widget isn't working.

how can fix user can enter search term page?

below xml code:

<item android:id="@+id/action_search"       android:icon="@drawable/ic_action_search"       android:title="@string/search_title"       android:showasaction="collapseactionview|always"       app:showasaction="always"       android:actionviewclass="android.widget.searchview" /> 

my onprepareoptionsmenu(), oncreateoptionsmenu() , onoptionsitemselected() identical in every activity , since work main page believe problem lies within xml file.

i prefer if search display rather moving overflow menu.

thanks time

just found solution, using support library compatibility needed use:

<item android:id="@+id/action_search"       android:icon="@drawable/ic_action_search"       android:title="@string/search_title"       android:showasaction="collapseactionview|always"       app:showasaction="collapseactionview|always"       app:actionviewclass="android.widget.searchview"       android:actionviewclass="android.widget.searchview" /> 

(i needed add app:actionviewclass). used explanation me

https://stackoverflow.com/a/22829368/3707803


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -