问题描述
我在一个活动中有一个片段,它不是“全屏”。 在此片段中,我有一个FloatingActionsMenu,我想这样:当我单击此按钮菜单时,它的子项出现了,我想在所有浮动按钮下但在整个屏幕上都设置一层深色且不透明的图层。
我正在尝试这种方法:创建一个包含我的按钮的自定义对话框视图,并在单击菜单按钮时显示它。 这似乎很复杂,因为我必须确保对话框中的按钮与片段中按钮的位置相同。 有没有更好,更简单的方法来做到这一点? 谢谢你GiGi
1楼
看一下这个库:
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu_yellow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="80dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
fab:menu_labels_style="@style/MenuLabelsStyle"
fab:menu_labels_showAnimation="@anim/jump_from_down"
fab:menu_labels_hideAnimation="@anim/jump_to_down"
fab:menu_animationDelayPerItem="0"
fab:menu_shadowColor="#444"
fab:menu_colorNormal="#FFB805"
fab:menu_colorPressed="#F2AB00"
fab:menu_colorRipple="#D99200">
使用它:
dependencies {
compile 'com.github.clans:fab:1.6.4'
}
2楼
如果您使用的是工具栏/未使用ActionBar,则应该能够在“活动”的布局中将深色的半透明视图放置在除Menu之外的所有其他视图上,然后将该视图的可见性从“不可见”更改为显示菜单时可见。