Forum Xamarin.Forms

Forms Switch doesn't look like I expected on android

danielrabdanielrab AUMember ✭✭

I placed a Forms.Switch into a stack layout on my current project as well as a completely new project and the switch looks like it should for iOS but it looks like an iOS slider with pink color for android too.

Here is a screenshot from my Android device. Side by side off-state(left) on-state(right)

I thought it was supposed to look rectangular on android devices?

Best Answers


  • gaminngaminn CZMember ✭✭

    How to make the switch look like native switch in Android? If it is not possible how to change the color of the switch (the purple color)?

  • danielrabdanielrab AUMember ✭✭
    edited November 2016

    Are you doing this for Xamarin Forms?

    It seems like you will have to write a custom renderer.

  • gaminngaminn CZMember ✭✭

    Hi! Thanks for the code. Yes, I'm doing this in Xamarin.Forms. I used it and the code is called during page initialization for every switch. I tried it with Argb(255, 0, 100, 255); or any other color, but the switch colors remain same (native Xamarin.Forms) all the time. So unfortunately the code does nothing.

  • gaminngaminn CZMember ✭✭

    Thanks, that's really easy!

  • SivaShankarArumugamSivaShankarArumugam USMember ✭✭✭

    @danielrab I have tried as discussed above, here when i change the colorAccent in style it works. same not applied for switch customrenderer.

    Is the there any way I can handle in customrenderer.

    I didn't add any code in android switchrenderer just implemented OnElementChanged method.

Sign In or Register to comment.