So I have started migrating to the official support design library for an Android app of mine, replacing elements as I go. I just replaced an
FAB (implemented as
ImageButton) with official
android.support.design.widget.FloatingActionButton. But the icon inside the button is smaller as compared to the one it was in
ImageButton. What may have been a reason?
<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 but that didn’t work, either.
This is how it looks after using
And this is how it looked like while using it as a
Set scale type to
Just a guess since you haven’t provided any details at all. The design library’s
FloatingActionButton has padding calculations which will shrink the icon if it is too large, whereas your
ImageButton probably just centers the icon with no scaling at all. I’m guessing that you would not observe this behavior if you were using a correctly sized 24dp icon, like the ones you get from: https://www.google.com/design/icons/.
You can use :
app:maxImageSize="..dp" to change the size of your icon!