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

Map not drawing correctly when switching pages on Android

$
0
0

Here's an odd one that's blocking progress; wasted 4+ hours so far. Works on iOS, not on Droid.

I have an app with 3 ContentPages. The main page ("A") has a map. Another page ("B") also has a map. The third page ("C") has a solid box. On iOS, it works as expected but on Droid, it doesn't. On Droid, when I navigate from "A" to "B", the map from "A" bleeds through onto "B". When I navigate from A" to "C", "C" looks good.

Any help appreciated.

I'm running
Xamarin Forms 1.3.4
Xamarin 3.9.289.0
Xamarin.Android 4.20.0.34
Xamarin.iOS 8.6.1.0
Xamarin.iOS Unified Migration 1.0


namespace MapTest
{
public class App : Application
{
ContentPage mainPage;
ContentPage mapPage;
ContentPage boxPage;

    public App()
    {
        var lexington = new Position(42.4430372, -71.228964);
        var span = MapSpan.FromCenterAndRadius(lexington, Distance.FromMiles(10));

        mapPage = new ContentPage
        {
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = {
                    new Label { VerticalOptions = LayoutOptions.Start, FontSize = 30, FontAttributes = Xamarin.Forms.FontAttributes.Bold, Text = "Map" },
                    new Map (span) { IsEnabled = true, IsVisible = true, IsShowingUser = true },
                }
            }
        };

        boxPage = new ContentPage
        {
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = {
                    new Label { VerticalOptions = LayoutOptions.Start, FontSize = 30, FontAttributes = Xamarin.Forms.FontAttributes.Bold, Text = "Box" },
                    new BoxView () { Color = Color.Blue, VerticalOptions = LayoutOptions.FillAndExpand }
                }
            }
        };

        mainPage = new ContentPage
        {
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = {
                    new Label { VerticalOptions = LayoutOptions.Start, FontSize = 40, FontAttributes = Xamarin.Forms.FontAttributes.Bold, Text = "Main Page" },
                    new Map (span) { IsEnabled = true, IsVisible = true, IsShowingUser = true },
                    new StackLayout () { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.Gray,
                        Children = {
                                new Button() { Text = "Map", Command = DoPopup, CommandParameter = mapPage },
                                new Button() { Text = "Box", Command = DoPopup, CommandParameter = boxPage  }
                        }
                    }
                }
            }
        };

        MainPage = new NavigationPage(mainPage);
    }

    public Command DoPopup
    {
        get { return new Command<ContentPage>((p) => ExecutePopupCommand(p)); }
    }

    private void ExecutePopupCommand(ContentPage popup)
    {
        mainPage.Navigation.PushAsync(popup); 
    }
}

}


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>