【问题标题】:How can I use ExtendedFloationgActionButton with Action Menus如何将 ExtendedFloatingActionButton 与操作菜单一起使用
【发布时间】:2019-11-06 05:02:50
【问题描述】:

我想在按下 ExtendedFloatingActionButton 时显示一个操作菜单,如图所示。我的菜单有 4 个项目,但我不知道如何轻松地使 FAb 展开以显示操作。

我知道 ExtendedFloatingActionButton 是 MaterialButton 的子类,而不是 FloatingActionButton,因此使用它与使用普通 FAB 略有不同

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp"
        app:backgroundTint="@color/colorAccent"
        android:contentDescription="Menu"
        android:text="Menu"
        app:iconTint="@color/card_background"
        android:textColor="@color/background_card"
        android:textStyle="bold"
        app:icon="@drawable/ic_menu_black_24dp" />

我想要这样的结果:

【问题讨论】:

    标签: android material-design floating-action-button


    【解决方案1】:

    我找到了一个 FloatingActionButton 的简单实现,但不是 ExtendedFloatingActionButton

    FAB transformation | animaiton-samples by android at GitHub

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-15
      • 2020-01-20
      • 1970-01-01
      相关资源
      最近更新 更多