Closed bkjbkjbnkj687698698 closed 7 years ago
You could add a listener after the menu was toggled (setOnMenuToggleListener
) or even use setOnMenuButtonClickListener
. Inside of one of these listeners you can get the icon and set a new drawable, example:
final Drawable originalImage = mFab.getMenuIconView().getDrawable();
mFab.setOnMenuButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mFab.isOpened()) {
// We will change the icon when the menu opens, here we want to change to the previous icon
mFab.close(true);
mFab.getMenuIconView().setImageDrawable(originalImage);
} else {
// Since it is closed, let's set our new icon and then open the menu
mFab.getMenuIconView().setImageDrawable(drawableManager.getDrawable(getActivity(), R.drawable.ic_edit_24dp));
mFab.open(true);
}
}
});
Result:
I want that to change the image of floating action menu in expanded state..Can i do that?