Android Switch - Strange

Good afternoon people!!

I'm developing an application via Xamarin Forms, and inexplicably all the "Switch" controls got horrible. As attachment.

I do not remember if it was some Xamarin update that did that.

This only happens on Android and only with this control.

Anyone have any idea what it could be?

Thank you

Posts

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    can you post your xaml?

  • LuizOliveiraLuizOliveira USMember ✭✭

    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:viewModel="clr-namespace:App.Mobile.ViewModel;assembly=App.Mobile" x:Class="App.Mobile.Pages.ProfilePage" Title="{Binding Title}"> <ContentPage.BindingContext> <viewModel:ProfileViewModel/> </ContentPage.BindingContext> <Grid x:Name="Grid"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Source="background_home.jpg" HeightRequest="200" Aspect="Fill"/> <BoxView Grid.Row="0" Grid.Column="0" Margin="0,30,0,0" HorizontalOptions="Center" WidthRequest="135" HeightRequest="135" StyleClass="Circle" BackgroundColor="White"/> <Image Grid.Row="0" Grid.Column="0" Margin="0,30,0,0" x:Name="UserPhoto" WidthRequest="130" HeightRequest="130" Source="{Binding UserPhoto,Mode=TwoWay}" StyleClass="Circle" HorizontalOptions="Center"/> <Label Grid.Row="1" Grid.Column="0" Margin="0,10,0,10" FontSize="20" Text="{Binding UserName,Mode=TwoWay}" HorizontalOptions="Center" TextColor="White" x:Name="UserName"/> <StackLayout Grid.Row="2" Grid.Column="0" Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="10,10,10,10"> <Label Text="Notificações" TextColor="Black" HorizontalOptions="StartAndExpand" VerticalOptions="Center"/> <Image Source="icon_information.png" WidthRequest="20" HorizontalOptions="EndAndExpand"> <Image.GestureRecognizers> <TapGestureRecognizer Command="{Binding Information}" CommandParameter="Notification"/> </Image.GestureRecognizers> </Image> <Switch IsToggled="{Binding StatusNotification,Mode=TwoWay}" HorizontalOptions="End" VerticalOptions="Center"/> </StackLayout> <StackLayout Grid.Row="3" Grid.Column="0" Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="10,10,10,10"> <Label Text="Carona" TextColor="Black" HorizontalOptions="StartAndExpand" VerticalOptions="Center"/> <Image Source="icon_information.png" WidthRequest="20" HorizontalOptions="EndAndExpand"> <Image.GestureRecognizers> <TapGestureRecognizer Command="{Binding Information}" CommandParameter="Ride"/> </Image.GestureRecognizers> </Image> <Switch IsToggled="{Binding StatusRide,Mode=TwoWay}" HorizontalOptions="End" VerticalOptions="Center"/> </StackLayout> <StackLayout Grid.Row="4" Grid.Column="0" Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="10,10,10,10"> <Label Text="Motorista" TextColor="Black" HorizontalOptions="StartAndExpand" VerticalOptions="Center"/> <Image Source="icon_information.png" WidthRequest="20" HorizontalOptions="EndAndExpand"> <Image.GestureRecognizers> <TapGestureRecognizer Command="{Binding Information}" CommandParameter="Driver"/> </Image.GestureRecognizers> </Image> <Switch IsToggled="{Binding StatusDriver,Mode=TwoWay}" HorizontalOptions="End" VerticalOptions="Center" IsEnabled="{Binding IsDriver}"/> </StackLayout> </Grid> </ContentPage>

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    have you tried to test it with another Android API?

  • LuizOliveiraLuizOliveira USMember ✭✭

    Yes. With 25, 24,23,22 and 21 =\

    I tested with the support APIs 24 and 25, also unsuccessful.

    :/

  • LuizOliveiraLuizOliveira USMember ✭✭
    edited April 2017

    I finally found the problem.

    <AndroidResgenExtraArgs>-non-crunch </AndroidResgenExtraArgs>

    I just do not know why it affected just that control.

    Thank you for your help.

Sign In or Register to comment.