Reputation: 45
I am using https://github.com/futuresimple/android-floating-action-button. How can I change the icon of the floating action menu, not the floating action button?
<!--This is the floating action menu-->
android:id="@+id/multiple_actions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
fab:fab_shadow="true">
<!--fab:fab_icon="@drawable/pencil_ico" in this doesn´t work>-->
<!--this are the floating action buttons-->
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!--fab:fab_icon="@drawable/pencil_ico" here it´s work-->
fab:fab_shadow="true"
fab:fab_colorNormal="#BFD22B"
fab:fab_title="Action A"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadow="true"
fab:fab_colorNormal="#BFD22B"
fab:fab_title="Action B"
fab:fab_colorPressed="#ff7e9024"/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_c"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_shadow="true"
fab:fab_colorNormal="#BFD22B"
fab:fab_title="Action C"/>
Upvotes: 0
Views: 2541
Reputation: 2875
I'd rather suggest using this library which is derived from com.getbase.floatingactionbutton.FloatingActionsMenu only.
You could change the icon by using following attribute in FloatingActionMenu:
fab:fab_menuIcon="@drawable/sort"
You can however use all the features of the parent library (com.getbase.floatingactionbutton.FloatingActionsMenu).
Upvotes: 0
Reputation: 1538
getMenuIconView is the method you need.
floatingActionMenu.getMenuIconView().setImageDrawable(Your Drawable);
Upvotes: 0
Reputation: 1215
In Style.xml under values folder you have the below code
<style name="menu_labels_style">
<item name="android:background">@drawable/fab_label_background</item>
<item name="android:textColor">@color/white</item>
</style>
You can change the icon of floating action menu by using the line
<item name="android:background">@drawable/your_icon_or_your_selector</item>
Upvotes: 1