浮动动作按钮和白色背景 [英] Floating action button and white background

查看:112
本文介绍了浮动动作按钮和白色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我正在寻找一种模仿FAB收件箱的方法.当用户按下红色按钮时,将出现一个不透明视图和一个菜单.由于图像更有意义,请参见下图

In fact, I search a way to mimic the FAB's inbox. When user press the red button, an opac view and a menu should appear. Because images are more more meaningful, see the following picture

我知道它存在这个很棒的库( https://github.com/futuresimple/android-floating-action-button ),并使用此库,我可以显示浮动操作菜单.但是我的问题是显示白色背景(不透明).我没有找到解决问题的方法...

I know it exists this wonderful library (https://github.com/futuresimple/android-floating-action-button) and with this library, i can display floating action menu. But my problem is displaying the white background (with opacity). I didn't find a solution to solve my problem ...

提前谢谢

推荐答案

FloatingActionMenu放在FrameLayout内,该cc将在其他视图之上,并且在宽度和高度上与父级匹配.使用相同的页边距抬起并相应地从菜单右移.

Place the FloatingActionMenu inside FrameLayout that will be on top of other views and will match parent in width and height. Use same margins to lift up and offset from right the menu accordingly.

OnFloatingActionsMenuUpdateListener设置为浮动操作菜单.现在,在方法内切换/替换框架布局的背景色:

Set OnFloatingActionsMenuUpdateListener to your floating action menu. Now toggle/replace frame layout background color inside methods:

 @Override
 void onMenuExpanded(){
  mFrameLayoutWrapper.setBackgroundColor(mAlpaWhite);
  }

  @Override
  void onMenuCollapsed(){
    mFrameLayoutWrapper.setBackgroundColor(Color.TRANSPARENT);
  }

这篇关于浮动动作按钮和白色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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