FAB 的 android.support.design.widget.FloatingActionButton 实现减小了图像尺寸

标签 android material-design floating-action-button

因此,我已经开始迁移到我的一个 Android 应用程序的官方支持设计库,并随时替换元素。我刚刚用官方 android.support.design.widget.FloatingActionButton 替换了一个 FAB(实现为 ImageButton)。但是与 ImageButton 中的图标相比,按钮内的图标要小一些。可能是什么原因?

FloatingActionButton 的实现:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/icon" />

尝试添加 app:fabSize="normal 但那也不起作用。

这是使用 FloatingActionButton 后的样子:

enter image description here

这是将它用作 ImageButton 时的样子:

enter image description here

最佳答案

将刻度类型设置为 android:scaleType="center"

关于FAB 的 android.support.design.widget.FloatingActionButton 实现减小了图像尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31277842/

相关文章:

android - 如何在底部应用栏上的 FloatingActionButton(fab)上方显示 Snackbar( Material 设计)

android - 使用 AppCompatActivity 而不是 Actionbar 时出现运行时错误

android - 在 Lollipop 之前的 CardView 下方的 float 操作按钮

java - Fab 图标大小更改

java - 如何在Java代码中使用当前日期以及注册期间使用的生日用户来计算年龄?

java - Timer多次添加某个TableRow

android - 如何更改 TextInputLayout 提示文本的背景颜色

android - FloatingActionButton 在 pre-lollipop 中占用额外的空间

Android:发送短信并使其显示在短信收件箱中?

android - Waze - 打开应用程序中的 waze.to 链接并开始导航,