Android代码,单击我的浮动操作按钮,在背景中创建半透明视图

Android代码,单击我的浮动操作按钮,在背景中创建半透明视图,android,Android,这就是我到目前为止所做的。已创建FloatingActionButton。现在我想在单击浮动按钮时设置一个透明背景层 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.getbase.floatingact

这就是我到目前为止所做的。已创建
FloatingActionButton
。现在我想在单击浮动按钮时设置一个透明背景层

<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.FloatingActionButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="openAttachment"
                    fab:fab_colorNormal="#89C440"
                    fab:fab_colorPressed="#89C440"
                    fab:fab_icon="@drawable/ic_action_attachment" />

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="openCamera"
                    fab:fab_colorNormal="#FE5722"
                    fab:fab_colorPressed="#FE5722"
                    fab:fab_icon="@drawable/ic_action_camera" />

            </com.getbase.floatingactionbutton.FloatingActionsMenu>

</RelativeLayout


您可以在java代码中创建浮动操作按钮的onclick方法

 public void openAudio(View v)
        {
        //Make parent relative layout to be translucent
findViewById(R.id.relativeLayout).setBackgroundColor(Color.parseColor("#80000000"));
        }

我想用第一个浮动操作按钮(加上图标)获得一个透明视图