ActionBar always expanded SearchView with the icon inside

前端 未结 3 1360
不知归路
不知归路 2021-01-14 13:37

I have an ActionBar with a SearchView.

I want the search view to always be \"open\" (expanded). Doing that is possible using

mSearchView.setIconifie         


        
3条回答
  •  天命终不由人
    2021-01-14 14:38

    Always show/expand search box on an action bar

    Its a 2 steps solution,

    1.public void onCreateOptionsMenu(M... ... searchView.setIconifiedByDefault(false); }

    2. In the menu xml file, make sure android:showAsAction="always" is set

    
    

提交回复
热议问题