1
votes

My app features a floating action button which size I would like to increase. I want it much bigger. Please note that I've already achieved to change its color by changing the background color of the style applied to the FAB. Unfortunatelly it does not yield the expected change with the following code :

    Font fabFont = UIManager.getInstance().getComponentStyle("Score").getFont();
    fabFont.derive(Display.getInstance().convertToPixels(ParametresGeneraux.getFabSizeInMilli()), Font.STYLE_PLAIN);
    fabStyle.setFont(fabFont);

The FAB size remains constant. What is the proper way to increase the FAB ?

Any help appreciated,

1

1 Answers

1
votes

This seems to be hardcoded in the class, notice that what you see in the FAB is the icon not the text so increasing the text size will do nothing. I have two potential solutions.

First I'll add a method to set the default FAB icon size in millimeters:

FloatingActionButton.setIconDefaultSize(4);

The current default is 3.8f which we found consistent with native.

The second method is on a per instance basis and will work before the library update today:

FontImage image = FontImage.createMaterial(icon, "FloatingActionButton", 4);
fabInstance.setIcon(image);

You can obviously increase the padding as well in the UIID to make the whole thing even bigger...