I am using this library for floating action button
https://github.com/futuresimple/android-floating-action-button
If anyone is aware about it, we know that we can change the background color of floating action menu with this line in xml :
fab:fab_addButtonColorNormal="@color/floating_action_menu"
Is there a way to do so programmatically??
floatingmenu.setBackgroundColor(color) doesnt work......
It looks like FloatingActionsMenu has no getter/setter for this. To get this feature you can fork the project and add getter for mAddButton
member of FloatingActionsMenu
class:
AddFloatingActionButton getAddButton(){
return mAddButton;
}
Then you will be able to call methods of FloatingActionButton
class :
floatingmenu.getAddButton().setColorNormal(...);
I got one solution
Add this method in FloatingActionsMenu class :
public void setNormalColor(int color) {
mAddButtonColorNormal = color;
removeView(mAddButton);
createAddButton(myContext);
}
It's works for me
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.