1

i am using android 3.0 actionbar with a dropdown and a searchWidget.

I would like to hide the dropdown when the user expands the search and unhide the dropdown when the user closes the search.

Here is a picture to explain bettere enter image description here

and here is the code i use to make the dropdown

ActionBar bar = this.getActionBar();
        bar.setTitle(this.getString(R.string.app_name));
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
...
        ListDittaListener listener = new ListDittaListener(this);
        bar.setListNavigationCallbacks( seleziona_ditta, listener);
max4ever
  • 11,909
  • 13
  • 77
  • 115

1 Answers1

4

Thanks to this https://stackoverflow.com/a/6454288/579646

searchView.setOnSearchClickListener( new OnClickListener() {

            @Override
            public void onClick(View v) {
                Log.v(MyApp.TAG, "search view On Search Click");


                ActionBar bar = FattureActivity.this.getActionBar();
                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            }
        });



        searchView.setOnCloseListener( new OnCloseListener() {

            @Override
            public boolean onClose() {
                Log.v(MyApp.TAG, "search view On Close");


                ActionBar bar = FattureActivity.this.getActionBar();

                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);


                return false;
            }
        });
Community
  • 1
  • 1
max4ever
  • 11,909
  • 13
  • 77
  • 115