question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Xamarin.Forms.Image Does Not Appear

See original GitHub issue

The Image does not appear when HorizontalOptions = LayoutOptions.CenterAndExpand

Reproduction Sample: https://github.com/brminnick/GlideX_HorizontalOptions_Repro

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jonathanpepperscommented, Oct 24, 2019

In some layouts you should try setting HeightRequest or WidthRequest.

The problem is a conflict in how Glide and Xamarin.Forms work: https://github.com/jonathanpeppers/glidex/issues/10#issuecomment-433109852

2reactions
brminnickcommented, Oct 31, 2018

Image in StackLayout Doesn’t Appear

Here’s another example where the image doesn’t appear; this time when it’s inside of a StackLayout

public class StackLayoutPage : ContentPage
{
    const string _xamarinImageUrl = "https://raw.githubusercontent.com/github/explore/06da849e137507b144448ac2b28bc19d3b909cab/topics/xamarin/xamarin.png";

    public StackLayoutPage()
    {
        var imageLabel = new Label { Text = "This image is broken" };
        var brokenImage = new Image { Source = _xamarinImageUrl };

        var stackLayout = new StackLayout
        {
            Children = {
                imageLabel,
                brokenImage
            }
        };

        Content = stackLayout;
    }
}

screenshot_1541018150

Workaround

Specifying a value for HeightRequest will allow the image to appear

public class StackLayoutPage : ContentPage
{
    const string _xamarinImageUrl = "https://raw.githubusercontent.com/github/explore/06da849e137507b144448ac2b28bc19d3b909cab/topics/xamarin/xamarin.png";

    public StackLayoutPage()
    {
        var imageLabel = new Label { Text = "This image is not broken" };
        var brokenImage = new Image
        {
            HeightRequest = 100,
            Source = _xamarinImageUrl
        };

        var stackLayout = new StackLayout
        {
            Children = {
                imageLabel,
                brokenImage
            }
        };

        Content = stackLayout;
    }
}

screenshot_1541018732

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin Forms, with Release mode, some pictures do not ...
Xamarin Forms, with Release mode, some pictures do not appear on the real device (Android) Images appear on the emulator with Debug and...
Read more >
Xamarin forms: Android 11 : Embedded resource images ...
I created a basic demo to display the embedded resource image on Android 11, it works as expected. The Resource ID should contain...
Read more >
Image Not Showing In Xamarin Forms App in release ...
After some tests it seems that if i unchek Bundle assemblies into native code i have my images in the Assembly properties ->...
Read more >
Android – Xamarin Forms image not showing
I have a Xamarin Forms (2.0) Android app where I'm trying to show an image. I've got an icon called icon-pages-r1.png which I'm...
Read more >
How to Display Image in Xamarin Forms - YouTube
LIKE | COMMENT | SHARE | SUBSCRIBE Welcome to Xamarin Forms Tutorials in Bangla, Today I will describe, How to Show ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found