DEV Community

Cover image for How to create a simple Floating Button with Xamarin.Forms/MAUI
Federico Navarrete
Federico Navarrete

Posted on

How to create a simple Floating Button with Xamarin.Forms/MAUI

For a while, I have been trying to search how to create a simple Floating Button and this is my final code:

<AbsoluteLayout>
     <!--Other components-->
     <ImageButton Source="plus.png" 
            BackgroundColor="Green"
        CornerRadius="80"
            AbsoluteLayout.LayoutFlags="PositionProportional"  
            AbsoluteLayout.LayoutBounds=".95,.95,80,80" />
</AbsoluteLayout>
Enter fullscreen mode Exit fullscreen mode
  • The Source is the picture you want to use.
  • The BackgroundColor is the color you want to use in HEX.
  • The CornerRadius is to create the form.
  • The AbsoluteLayout.LayoutBounds is the location.

This will be the result:

example

You can get the icon from:

https://materialdesignicons.com

And I got some inspiration from here:

https://stackoverflow.com/a/54519048/1928691

Top comments (0)