android浮动按钮_Android扩展浮动操作按钮

android浮动按钮

Extended Floating Action Button is the newly introduced class with Material Components library in Android.
Material Components is introduced with SDK 28 or Android P. It’s a superset of Support Design Library with lots of new additions and improvements. In this tutorial, we’ll be focusing on Extended FAB an extension of Floating Action Button.

Extended Floating Action Button是Android中新引入的带有Material Components库的类。
材料组件随SDK 28或Android P引入。它是支持设计库的超集,其中包含许多新增功能和改进功能。 在本教程中,我们将集中于Extended FAB,它是Floating Action Button的扩展。

扩展的浮动动作按钮 (Extended Floating Action Button)

Much like its name, it extends the floating action button.
Talking about functionality, Extended FAB contains a text alongside the icon to provide more info.

就像它的名字一样,它扩展了浮动动作按钮。
关于功能,扩展FAB在图标旁边包含一个文本,以提供更多信息。

This class is extended from the MaterialButton class and not the FloatingActionButton.

此类是从MaterialButton类而不是FloatingActionButton扩展的。

An extended fab is wider in width than a FAB. Though it can be shrunk to show icon only depending on the behavior you choose.

扩展晶圆厂的宽度比FAB宽。 尽管仅根据您选择的行为可以缩小显示图标。

To use an Extended FAB we need to import the google material components dependency as shown below (the version number might be higher than the one below when you are reading this):

要使用扩展FAB,我们需要导入google材质组件依赖项,如下所示(当您阅读此版本时,其版本号可能高于以下版本):

implementation 'com.google.android.material:material:1.1.0-alpha09'

Note: Material components require the activity to have a Theme.MaterialComponents or descendants dependency.

注意 :材质组件要求活动具有Theme.MaterialComponents或后代依赖项。

Here’s how we define an extended FAB in our layout:

这是我们在布局中定义扩展FAB的方法:

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
        android:id="@+id/extFab"
        android:layout_width="wrap_content"
        an
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值