如何改变浮动操作菜单的背景颜色 [英] How to change background color of floating action menu

查看:271
本文介绍了如何改变浮动操作菜单的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个库浮动操作按钮

I am using this library for floating action button

https://github.com/futuresimple/android-floating-action-button

如果任何人知道这件事,我们知道我们可以改变浮动操作菜单的背景颜色与此行的xml:

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_addButtonColorNormal =@色/ floating_action_menu

有没有办法这样做编程?

Is there a way to do so programmatically??

floatingmenu.setBackgroundColor(颜色)
不工作......

floatingmenu.setBackgroundColor(color) doesnt work......

推荐答案

我得到了一个解决方案。

I got one solution

在FloatingActionsMenu类添加这个方法:

Add this method in FloatingActionsMenu class :

public void setNormalColor(int color) {
        mAddButtonColorNormal = color;
        removeView(mAddButton);
        createAddButton(myContext);
    }

这对我的作品

这篇关于如何改变浮动操作菜单的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆