As promised, here is another release of one of my GitHub libraries for Xamarin! This time we are talking about the
FloatingActionButton or “FAB”!
Here are some important links:
Don’t forget to read up on my original post on how to create your own
FloatingActionButton and how to use it: Xamarin.Controls – Xamarin.Forms FloatingActionButton (including iOS!)
A custom view to create a FloatingActionButton for both Android and iOS as part of Material Design
That’s right, even on iOS!
How to use
Clone the repository and open include the
src projects in your Xamarin.Forms and Platform projects.
Now Available on NuGet!
Special note for iOS: Make sure to call
FloatingActionButtonRenderer.InitRenderer(); in your
AppDelegate.cs in order to avoid linking it out.
Then you can include it in your XAML or call it from C# (See the example projects for a demo):
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:SuaveControls.FabExample" xmlns:controls="clr-namespace:SuaveControls.Views;assembly=SuaveControls.FloatingActionButton" x:Class="SuaveControls.FabExample.MainPage"> <StackLayout Margin="32"> <Label Text="This is a Floating Action Button!" VerticalOptions="Center" HorizontalOptions="Center"/> <controls:FloatingActionButton x:Name="FAB" HorizontalOptions="CenterAndExpand" WidthRequest="50" HeightRequest="50" VerticalOptions="CenterAndExpand" Image="ic_add_white.png" ButtonColor="#03A9F4" Clicked="Button_Clicked"/> </StackLayout> </ContentPage>
- Make it more flexible. Add Different color states, add sizing adjustments, etc.
- Create UWP implementation
- Create Xamarin Component
Come support the project and join the contributors list! We would love to see this
TODO list dropped to nothing!
Interested in sponsoring developer content? Message @Suave_Pirate on twitter for details.