简体   繁体   English

无法平移或缩放 Xamarin.Forms.GoogleMaps

[英]Unable to pan or zoom Xamarin.Forms.GoogleMaps

I am looking to use Xamarin.Forms.GoogleMaps in our application.我希望在我们的应用程序中使用 Xamarin.Forms.GoogleMaps。 The maps displays fine and marks the location but we are unable to interact with the map.地图显示良好并标记了位置,但我们无法与 map 交互。 (ie. pan the map left and right or zoom in/out or play with markers) (即左右平移 map 或放大/缩小或使用标记播放)

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
    Title="Pick your area"
    Shell.TabBarIsVisible="False">
    <ContentPage.Content>

        <AbsoluteLayout>
            <StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">

                <maps:Map
                    x:Name="locationMap"
                    HasScrollEnabled="True"
                    HasZoomEnabled="True"
                    HeightRequest="300"
                    MapClicked="locationMap_MapClicked"
                    MapLongClicked="locationMap_MapLongClicked"
                    VerticalOptions="Start" />
                <StackLayout
                    Margin="20,5"
                    Orientation="Horizontal"
                    VerticalOptions="Center">
                    <Label
                        Style="{StaticResource SectionHeaders}"
                        Text="Choose from saved locations:"
                        VerticalTextAlignment="Center" />
                    <Picker
                        Title="Pick address"
                        HorizontalOptions="End"
                        ItemDisplayBinding="{Binding Name}"
                        ItemsSource="{Binding SavedAddresses}"
                        SelectedIndexChanged="Picker_SelectedIndexChanged" />
                </StackLayout>


            </StackLayout>

        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>

The application is based on该应用程序基于

  • Xamarin Forms 4.5.0 Xamarin Forms 4.5.0
  • Xamarin Form GoogleMaps 3.3.0 Xamarin 表格 GoogleMaps 3.3.0

It is a shell architecture.它是 shell 架构。

If anyone can help us use it, it would be great help.如果有人可以帮助我们使用它,那将是很大的帮助。

Thanks in advance提前致谢

I write Shell and Xamarin Form GoogleMaps demo to test it.我编写ShellXamarin Form GoogleMaps演示来测试它。 Here is running GIF.这里正在运行 GIF。

在此处输入图像描述

It is running normally, my nuget package version like following sceenshot.(I test it in Android 8.1 and Android 9.0, both of them are Ok) It is running normally, my nuget package version like following sceenshot.(I test it in Android 8.1 and Android 9.0, both of them are Ok)

在此处输入图像描述

Here is demo, you can download it and test it in your emulator, please do not forget to the change api key in your AndroidManifest.xml .这是演示,你可以下载它并在你的模拟器中测试它,请不要忘记在你的AndroidManifest.xml中更改 api 键。

<meta-data android:name="com.google.android.geo.API_KEY" android:value="api key" />

https://github.com/851265601/ShellAndGoogleMapPlugin https://github.com/851265601/ShellAndGoogleMapPlugin

Sorry, turns out it was really stupid.对不起,事实证明这真的很愚蠢。 There was an absolutely placed control of list view that was in hidden state which prevented interaction.在隐藏的 state 中有一个绝对放置的列表视图控件,它阻止了交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM