Flat Material design button in Forms

MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

I try to show a flat button like it is described in the material design guidelines.
In my naive way of thinking I tried to create a custom renderer which inherits from Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer. This got me an Android.Support.V7.Widget.AppCompatButton, but the Elevation on that control is already 0. How can I remove the shadow?

The simplest standard Android solutions made a

<Button style="@style/Widget.AppCompat.Button.Borderless"/>

But how do I change the style of the existing AppCompatButton?

Other more complicated examples used many xml files to re-create the ripple effect, pressed state, ... But the standard button can already do this, so all I want is change that AppCompatButton to remove the shadow.

I could just use a Xamarin.Forms.Label, but this has no padding, no ripple effect, no pressed state. I don't want to reinvent the wheel.


  • Jan.NeprasJan.Nepras USMember ✭✭

    Were you able to find out the solution? I have 3 buttons in stacklayout and the first button is renderer and has different style on android 4 than normal buttons. I have no clue how to fix this.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    Unfortunately not. But I use different layouts on iOS and Android here, so I just replaced the button with a ContentView including a Label. Ugly, but it works.

  • RobinAlderliestenRobinAlderliesten NLUniversity

    @Korayem, I owe you man! Been searching everywhere for a way to remove those darn shadows!

Sign In or Register to comment.