如何给 FABRevealMenu 充气?(该项目的维基页面在这里)
由于我是新手,我无法理解这些行中提到的要膨胀的布局:
您可以通过两种方式扩充自定义视图
app:menuCustomView="@layoutRes" // 你可以通过在 fabRevealMenu 实例上调用 getCustomView() 来获取自定义视图对象
设置自定义视图(视图)
目前,我在我的应用程序中看不到任何 FABRevealMenu 并且没有收到任何错误。
我将此添加到 app_bar_main.xml:
<com.hlab.fabrevealmenu.view.FABRevealMenu
android:id="@+id/fabMenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
app:animateItems="true"
app:menuBackgroundColor="@color/blue_semi_transparent"
app:menuDirection="left"
app:menuRes="@menu/main"
app:menuSize="normal"
app:menuTitleDisabledTextColor="@color/white"
app:menuTitleFontFamily="@font/italiana"
app:menuTitleTextColor="@color/white"
app:overlayBackground="@color/colorBlack"
app:showOverlay="true"
app:showTitle="true" />
提前致谢!
你必须先创建一个 fab 按钮,然后在这个按钮上分配这个 feb 菜单
final FloatingActionButton fab = view.findViewById(R.id.fab);
final FABRevealMenu fabMenu = view.findViewById(R.id.fabMenu);
//attach menu to fab
fabMenu.bindAnchorView(fab);
//set menu selection listener
fabMenu.setOnFABMenuSelectedListener(this);
不要忘记在您的活动/片段中实现 OnFABMenuSelectedListener
如果您有任何问题,请自由提问!!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句