Search code examples
androidsearchview

Show Menu Item when SearchView Expanded


i need a help...i found similar question on SO here enter link description here but there is no solution so i have posted this.

In my app. i want my searchview always expanded...for that i am using this code

SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
            searchView.setIconifiedByDefault(false);

It shows searchview expanded but it hides other menu icons...i also want to show other menu icons with like this

enter image description here

Please help me..


Solution

  • finally i found a solution......

    ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT);
                params.width=200;
                searchView.setLayoutParams(params);
                menu.findItem(R.id.action_search).expandActionView();