I\'m trying to create a floating button in my app. The button is there, but the image in the button is a bit upwards (see image).
I can\'t figure out what\
Reason is your image is not in the right size!!
Floating action button default circle size is 56 x 56dp , to get the best fit use that for your background image!!
If you are going for a mini one should be : 40 x 40dp
If you only want to change the Interior icon(only icon) use a 24 x 24dp icon for default size
To test this again i download an image form internet and scaled it down to 56dp and kept a small space to balance it (i am no good with Photoshop)
and added this to your FB view and made background yellow to make it clear.Let's see
out put:
This means it depends on the image that you add and its size if you want to go full background you can even use an imageButton
Refer : https://material.io/guidelines/components/buttons-floating-action-button.html#buttons-floating-action-button-floating-action-button
I have faced the same problem. the following solution have worked for me
app:fabCustomSize="40dp"
Use (https://github.com/futuresimple/android-floating-action-button) and set fab:fab_icon="@drawable/ic_fab_star" to center icon
You have to add only app:fabCustomSize="40dp"
it's work for me
I just set the app:fabCustomSize=”40dp” (needed size) and I set the height and width as wrap_content then issue solved
Try to do to fix your height and width...
android:layout_width="50dp"
android:layout_height="50dp"
and please adjust your layout in bottom another way ..bacause here yo do
android:layout_marginTop="480dp"
it is not a proper way my suggestion try to set your FloatingActionButton inside Relative Layout..and set like this property..
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"