如何在安卓中将浮动操作按钮(FAB)的图标设置为居中。

huangapple go评论75阅读模式
英文:

how to set icon center in fab in android

问题

如何在安卓中使com.google.android.material.floatingactionbutton.FloatingActionButton中的图标居中?

当我在手机的正常屏幕尺寸上运行应用时,图标显示正常,但当我在10英寸的平板上运行应用时,浮动操作按钮(FAB)的尺寸变小了,所以如何在安卓的任意屏幕尺寸上正确实现FAB的尺寸?

提前感谢。

如何在安卓中将浮动操作按钮(FAB)的图标设置为居中。

英文:

how to icon center in com.google.android.material.floatingactionbutton.FloatingActionButton in android ?

when I run the app in normal screen size of mobile then properly show, but I run the app in 10' inch tablet then fab size is small, so how to implement fab properly in any size of the screen in android?

Thanks, in advance.

如何在安卓中将浮动操作按钮(FAB)的图标设置为居中。

答案1

得分: 1

好的,以下是您要求的翻译部分:

1. 为平板电脑或大屏幕设备设计单独的布局,并使用以下属性将 Fab 设置为自定义大小。

app:fabCustomSize="100dp"

2. 请确保您没有覆盖属性 app:fabSize 并将其值设置为 mininormal。默认情况下,您的 fab 大小值固定为 auto

app:fabSize="auto"

3. 根据所需外观,您可以通过以下方式将 fab 更改为扩展型 ExtendedFloatingActionButton

com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
英文:

You have these choices.

  1. Design a separate layout for tablet or large screen devices and set Fab to custom size with this attribute.
app:fabCustomSize="100dp"
  1. Make sure you are not overriding the attribute app:fabSize with value mini or normal. By default your fab size value is fixed to auto
app:fabSize="auto"
  1. Based on how it want to look, you can change the fab to extended by using this <tag
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton

huangapple
  • 本文由 发表于 2020年9月19日 18:05:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/63967536.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定