SuaveControls.MaterialFormControls
SuaveControls.MaterialFormControls copied to clipboard
How to apply a shadow effect on Android for the MaterialButton?
Hello, I use the MaterialButton on an app.
The shadow is well applied on iOS, but not on Android.
I first apply a style on the MaterialButton:
<Style x:Key="LightButton" TargetType="ctrl:MaterialButton">
<Setter Property="FontFamily" Value="{StaticResource MontserratFont}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="BorderRadius" Value="0" />
<Setter Property="TextColor" Value="#EA3024" />
<Setter Property="BackgroundColor" Value="#FFFFFF" />
</Style>
Then I use it like this in my pages:
<ctrl:MaterialButton Style="{StaticResource FncLightButton}"
Elevation="4"
Text="ANNULER
Command="{Binding CancelCommand}"
Margin="0, 0, 10, 0">
Is it normal? How should I achieve this?
Is your Android Theme set to something inheriting from AppCompat?
Yes the main theme inherits from AppCompat:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
...
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
What version of Xamarin.Forms and did you call the renderer init?
I use the latest "stable" version of Xamarin.Forms and I have well called the renderer init. I will create a new sample project to reproduce this issue.