GridView 阻塞图像 TapGestureRecognizer

问题描述

我无法让图像点击移动到设置了 gridview 的下一页。当我有 stackview 时,我没有问题。我也试过检查 InputTransparent 没有运气。我正在使用 Xamarin.Forms 并使用 android 进行测试。帮助?

    <ContentPage.Content>
        <Grid>
                    <Grid.RowDeFinitions>
                        <RowDeFinition />
                        <RowDeFinition />
                    </Grid.RowDeFinitions>
                    <Grid.ColumnDeFinitions>
                        <ColumnDeFinition />
                        <ColumnDeFinition />
                    </Grid.ColumnDeFinitions>

                    <Image Grid.ColumnSpan="2" Source="{local:ImageResource HemaSwordFiore.Images.BGAxe.LongTail.jpg} " 
                           VerticalOptions="Center"  
                           HorizontalOptions="Center">
                        <Image.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_1" 
                                  NumberOfTapsrequired="1"/>
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.ColumnSpan="2" Text="Axe in Armor" Style="{StaticResource SubHeader}"
                           HorizontalOptions="CenterandExpand"/>
                    <!-- missing titles and imgaes -->

                    <Image Grid.Row="1" Source="{local:ImageResource HemaSwordFiore.Images.BGSpear.BoarsTusk.png} " 
                           VerticalOptions="Center"  
                           HorizontalOptions="Center">
                        <Image.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_2" 
                                  NumberOfTapsrequired="1"/>
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1" Text="Spear" Style="{StaticResource SubHeader}"
                           HorizontalOptions="CenterandExpand" InputTransparent="True" />
 
                </Grid>
    </ContentPage.Content>
</ContentPage>

这是背后的代码

        private async void TapGestureRecognizer_Tapped_1(object sender,EventArgs e)
         {
            await Navigation.PushAsync(new SAAxe1());
         }
        private async void TapGestureRecognizer_Tapped_2(object sender,EventArgs e)
         {
             await Navigation.PushAsync(new SASpear1());
         }
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)