SwipeGestureRecognizer don't work on android but works great in IOS

davidra7davidra7 Member
edited February 12 in Xamarin.Forms

Hi,
I am trying to enable swipe gesture on android and IOS, I am using grid view for entire screen, it works perfectly on IOS but don't work on android , any Ideas?

Code:

<code>
<Grid x:Name="GridBox" RowSpacing="0" ColumnSpacing="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
         <Grid.GestureRecognizers>
            <SwipeGestureRecognizer Direction="Left" Swiped="Handle_Swiped_Left" Threshold="1" />
            <SwipeGestureRecognizer Direction="Right" Swiped="Handle_Swiped_Right" Threshold="1"/>
        </Grid.GestureRecognizers>
        <StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="0" >
            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="ProductPressedHandler"/>
            </StackLayout.GestureRecognizers>
            <Label HorizontalOptions="Center" Margin="0,5,0,0" Text="product Title" TextColor="Red" FontSize="20"/>
            <Label Text="12345678902323424" TextColor="Black" FontSize="14"/>
                      <Image BackgroundColor="White">
               <Image.Source> 
                    <OnPlatform x:TypeArguments="ImageSource"> 
                        <On Platform="Android" Value="logo.png"/>
                        <On Platform="iOS" Value="Logo.png"/>
                    </OnPlatform> 
                </Image.Source>      
           </Image>
        </StackLayout>
        <StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="1">
            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="ProductPressedHandler"/>
            </StackLayout.GestureRecognizers>
            <Label HorizontalOptions="Center" Margin="0,5,0,0" Text="product Title" TextColor="Red" FontSize="20"/>
            <Label Text="12345678902323424" TextColor="Black" FontSize="14"/>
            <Image Source="Logo.png" />
        </StackLayout>
        <StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="1" Grid.RowSpan="1" >
            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="ProductPressedHandler"/>
            </StackLayout.GestureRecognizers>
            <Label HorizontalOptions="Center" Margin="0,5,0,0" Text="product Title" TextColor="Red" FontSize="20"/>
            <Label Text="12345678902323424" TextColor="Black" FontSize="14"/>
            <Image Source="Logo.png" />
        </StackLayout>
        <StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1" >
            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="ProductPressedHandler"/>
            </StackLayout.GestureRecognizers>
            <Label HorizontalOptions="Center" Margin="0,5,0,0" Text="product Title" TextColor="Red" FontSize="20"/>
            <Label Text="12345678902323424" TextColor="Black" FontSize="14"/>
            <Image Source="Logo.png" />
        </StackLayout>
        <ActivityIndicator Color="Red" x:Name="Loader" IsVisible="false" IsRunning="false" BackgroundColor="White" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="2"/>
        <Button BackgroundColor="Red" Text="Order" HorizontalOptions="FillAndExpand" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2"  Padding="0" Margin="0" TextColor="White" />
    </Grid>

Thanks!!
David

Answers

Sign In or Register to comment.