Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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

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

    @gaminn
    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.