如何膨胀 FABRevealMenu?
How to inflate FABRevealMenu?
如何给 FABRevealMenu 充气? (the project's wiki page is here)
由于我是新手,我无法理解这些行中提到的要膨胀的布局:
You can inflate custom view by two ways
app:menuCustomView="@layoutRes" // you can get custom view object by calling getCustomView() on fabRevealMenu instance
setCustomView(View)
目前,我在我的应用程序中看不到任何 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 按钮,然后在该按钮上分配此二月菜单
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);
不要忘记在 activity/fragment
中实现 OnFABMenuSelectedListener
有问题尽管问!!
如何给 FABRevealMenu 充气? (the project's wiki page is here)
由于我是新手,我无法理解这些行中提到的要膨胀的布局:
You can inflate custom view by two ways
app:menuCustomView="@layoutRes" // you can get custom view object by calling getCustomView() on fabRevealMenu instance
setCustomView(View)
目前,我在我的应用程序中看不到任何 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 按钮,然后在该按钮上分配此二月菜单
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);
不要忘记在 activity/fragment
中实现 OnFABMenuSelectedListener有问题尽管问!!