Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Setting switch width

$
0
0

Hi guys,

I'm using a custom renderer to change the drawable used for the thumb and track parts of a switch on Android. However, the drawable is an oval shape, very similar to the native look of an iOS switch. Even when changing the drawables, the switch keeps it's rectangular look that is native to an Android switch which results in the switch looking stretched out and the thumb part doesn't smoothly fit in to the track part at each side.

I have tried changing the width of the switch but instead of changing the width, it just seems to cut off the left part of the switch from whichever point I declare the width of the control to be. I have browsed around and could only find very little documentation on this issue which said to set the SwitchMinWidth property. However, this doesn't seem to have any effect whatsoever.

Has anyone had success in setting the Thumb and Track resources of a switch to their own drawable in an Android custom renderer without it stretching the image to fill the rectangular nature of the native control? If someone has experienced the same problem before, have they found a solution?

Many thanks,
Mike.


Viewing all articles
Browse latest Browse all 75885

Trending Articles