当我单击浮动操作菜单时,我想设置一个透明的背景层. [英] I want to set a transparent background layer when I click on the floating action menu.

查看:55
本文介绍了当我单击浮动操作菜单时,我想设置一个透明的背景层.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我到目前为止所做的.创建了FloatingActionButton.现在,当按下+图标时,背面应该有一个半透明层.

This is what I have done so far. Created FloatingActionButton. Now As the + icon is pressed a translucent layer should be there at the back.

<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
 <com.getbase.floatingactionbutton.FloatingActionsMenu
                android:id="@+id/actionMenu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:layout_marginBottom="60dp"
                fab:fab_addButtonColorNormal="@color/primary"
                fab:fab_addButtonColorPressed="@color/primary_dark"
                fab:fab_addButtonPlusIconColor="#ffffff">

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="openAudio"
                    fab:fab_colorNormal="#EA1E63"
                    fab:fab_colorPressed="#EA1E63"
                    fab:fab_icon="@drawable/ic_action_mic" />
 </com.getbase.floatingactionbutton.FloatingActionsMenu>

</RelativeLayout

推荐答案

尝试一下.

floatingActionMenuButton.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
            @Override
            public void onMenuToggle(boolean opened) {
                if (opened) {
                    //menu opened
                } else {
                    //menu closed
                }
            }
        });

这篇关于当我单击浮动操作菜单时,我想设置一个透明的背景层.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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