arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 668 forks source link

menuItem.setIcon not working in floatingSearchView.setOnMenuItemClickListener #243

Open dmitryermichev opened 7 years ago

dmitryermichev commented 7 years ago

I want to change menu icon in floatsearchview, for example:

floatingSearchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {
            @Override
            public void onActionMenuItemSelected(MenuItem item) {
                if(item.getItemId() == R.id.action_location) {
                    if(locationEnabled) {
                        item.setIcon(R.drawable.ic_action_location_disabled);
                        locationEnabled = false;
                        Log.d(this.getClass().getName(), "location disabled");
                    } else {
                        item.setIcon(R.drawable.ic_action_location);
                        locationEnabled = true;
                        Log.d(this.getClass().getName(), "location enabled");
                    }
                }
            }
        });

Icon not changing. I can't find any methods like invalidate(), or something like this.

randomlock commented 7 years ago

Any solution ?

Naguchennai commented 6 years ago

i also need this

Naguchennai commented 6 years ago

Any solution? Any hell?

wqqgt commented 4 years ago

me to, so I change style to tab for replaced menu