带有文本而不是图像的FloatingActionButton [英] FloatingActionButton with text instead of image
本文介绍了带有文本而不是图像的FloatingActionButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找出如何从android支持库中修改FloatingActionButton.可以与文本一起使用而不是图像吗?
I'm trying to figure out how can be modified FloatingActionButton from android support library. Can it be used with the text instead of image?
类似这样的东西:
我看到它扩展了ImageButton,所以我认为不是.我说的对吗?
I see it extends ImageButton so I think not. Am I right?
就材料设计而言,这是否正确?
Is this correct in terms of Material Design in general?
推荐答案
使用API 28,您可以使用以下命令将文本简单地添加到Fab中:
With API 28 you can simply add text to Fabs using:
访问: https://material.io/develop/android /components/extended-floating-action-button/
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:contentDescription="@string/extended_fab_content_desc"
android:text="@string/extended_fab_label"
app:icon="@drawable/ic_plus_24px"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|right|end"/>
这篇关于带有文本而不是图像的FloatingActionButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文