How can I change the floating action menu icon?
I have tried to add the fab:fab_icon just like on floating buttons, but it does not seem to work. Is there any way to change the background image on the floating menu also, except the buttons?
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/left_labels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/mapstyle"
fab:fab_addButtonColorNormal="@color/white"
fab:fab_addButtonColorPressed="@color/white_pressed"
fab:fab_addButtonPlusIconColor="@color/half_black"
fab:fab_expandDirection="down"
fab:fab_icon="@drawable/map_marker"
fab:fab_labelStyle="@style/menu_labels_style"
fab:fab_labelsPosition="left">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/alle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/white_transparent"
fab:fab_colorPressed="@color/white_pressed"
fab:fab_icon="@drawable/map_marker"
fab:fab_size="mini"
fab:fab_title="Alle" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
Thank you in advance for your time and effort.
For the icon you just need to set android:src="" filled with a drawable
I did also tried that, but it did not work. :( Thanks for your time and effort though... :D
+1 to @thanos1983 ...... did u find the answer?
Hello @rohitkeshwani07,
I do not have a solid solution to my problem but I have created a work around. Because the answer is big to rewrite it I will provide a link in case that someone in the future might have the same problem How to set icon to getbase FloatingActionsMenu. I have also found a solution in order to update the menu icon from the "sub buttons" when they are clicked Change image Floating Action Button Android
I hope this helps somebody else that had the same problem. If you have any queries or my answer is not complete get back to me and I will try to help you.
Please use: ... android:src="@android:drawable/ic_menu_share" ... Don't use "fab:icon...", but instead use "android:src..." It works for me👍 X5ibnouf
Hello @ibnouf88 ,
I just tried it, and for me is not working. I do not know if it it not working because I have modified the library or it does not work generally. But the solution that I have posted it works just fine for me. :D
Maybe someone else can tested and verify that it works.
i can confirm that "android:src" has no effect.
Using: 'com.getbase:floatingactionbutton:1.10.1'
Trying this library, you can use custom icon for menu button by using: fab:fab_menuIcon="@drawable/myIcon"
https://github.com/toanvc/FloatingActionMenu-Animation
if you are using the source not gradle lib then use his changes to the sources.
I am also not getting menu icon using android:src="@drawable/*" and using com.getbase:floatingactionbutton:1.10.1 included in gradle as of @Ostkontentitan
For the menu icons I ended up doing it in Java:
FloatingActionButton btn = view.findViewById(R.id.buttonID);
btn.setIcon(R.drawable.myimage);
I also downloaded the library to use in my project locally, not sure if that makes a difference.
using this library com.github.clans.fab.FloatingActionMenu
app:menu_icon="@drawable/ic_share" above solution worked for me.