Xamarin.Forms.GoogleMaps icon indicating copy to clipboard operation
Xamarin.Forms.GoogleMaps copied to clipboard

Custom Pin Not Showing

Open chrisfoulds opened this issue 5 years ago • 4 comments

VERSIONS

  • Xamarin.Forms.GoogleMaps -3.3.0
  • Xamarin.Forms - 4.2.0.910.310

PLATFORMS

  • [x ] Android
  • [ ] iOS
  • [ ] UWP

ACTUAL BEHAVIOR

Image with Pin not showing I am using the following code, I get a coloured square at the correct location just no image.

`var startPin = new Pin()
            {
                Type = PinType.Place,
                Label = "Start",
                ZIndex = 5,
                Address = DateTimeToString(currentRun.startDateTime, true),
                Position = new Position(startItem.position.Latitude, startItem.position.Longitude),
            };

            startPin.Icon = BitmapDescriptorFactory.FromView(
                    new ContentView
                    {
                        WidthRequest = 45,
                        HeightRequest = 45,
                        BackgroundColor=Color.Blue,
                        Content = new Image
                        {
                            Source = ImageSource.FromFile("fas_dot_circle.png")

                        }
                    }
                );`

If I change the content to this, the text shows I just can't get an image to display

` Content = new Label
                        {
                            Text="Hello" , TextColor=Color.White

                        }`

EXPECTED BEHAVIOR

To see the image, not just get the background color as a square.

chrisfoulds avatar Dec 17 '19 14:12 chrisfoulds

I also got this issue. Seems like PinLogic.TransformXamarinViewToAndroidBitmap() cannot properly convert the XF view to the Android view. After a few try, I suspect the Platform.GetRenderer(view) only return the top level element.

My solution for this issue to fork the library and update the PinLogic and MapRenderer classes to handle the custom pins. See issue #681 for more details.

KevinHu-au avatar Dec 18 '19 04:12 KevinHu-au

Get the same but on both platforms

microsec-bohdan avatar Dec 10 '21 12:12 microsec-bohdan

I can reproduce it on all Android devices only

bbenetskyy avatar Feb 18 '22 11:02 bbenetskyy

It only renders the first element passed into BitmapDescriptorFactory.FromView on Android right now.

hvaughan3 avatar Nov 29 '22 01:11 hvaughan3