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

BoxView displayed on iOS and not on Android

$
0
0

Hello,

I am facing some troubles with a BoxView. I would like to put an image in the background with an opacity.
This works perfectly fine on iOS but not on Android. The image is not displayed on Android, I only get a sort of white BoxView. (It's not a white BoxView, because I tried to put a blue color and nothing changed). Here is my code :

public class MyPage : ContentPage
{
MenuItem _cra;
AbsoluteLayout _layoutPrincipal;

    public MyPage ()
    {
        SetBackGround ();

        // Build the page.
        this.Content = _layoutPrincipal;
    }

    void SetBackGround ()
    {

        this.BackgroundColor = Color.FromHex ("F2EFF2");

        _layoutPrincipal = new AbsoluteLayout {
            VerticalOptions = LayoutOptions.FillAndExpand
        };

        var voile = new BoxView {
            BackgroundColor = Color.White,
            Opacity = 0.9
        };

        var image = new Image () {
            Source = "Logo.png"
        };

        AbsoluteLayout.SetLayoutFlags (image,
            AbsoluteLayoutFlags.PositionProportional);

        AbsoluteLayout.SetLayoutBounds (image,
            new Rectangle (0.5,
                0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
        _layoutPrincipal.Children.Add (image);

        AbsoluteLayout.SetLayoutFlags (voile,
            AbsoluteLayoutFlags.All);

        AbsoluteLayout.SetLayoutBounds (voile,
            new Rectangle (0,
                0, 1, 1));
        _layoutPrincipal.Children.Add (voile);
    }

}
Do you see anything ?

Thank you very much.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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