图像- Xamarin.Form [英] Image- Xamarin.Form

查看:26
本文介绍了图像- Xamarin.Form的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一个登录页面,现在我想添加一个标题图片;但是,图像不会显示在视图中.

I have implemented a login page and now I want to add a header image; however, image does not show up on the view.

    public LoginView ()
    {
        InitializeComponent ();

        Title= "Login";

        Content = new StackLayout {
            Spacing = 20,
            Padding = 50,
            VerticalOptions = LayoutOptions.Center,
            Children = {
                new Image {Source="headerImage.jpg"},
                (username = new Entry { Placeholder = "Username" }),
                (password = new Entry { Placeholder = "Password", IsPassword = true }),
                (button=new Button { Text = "Login", TextColor = Color.White, BackgroundColor = Color.FromHex ("77D065")})
            }
        };

        button.Clicked += Login;
    }

推荐答案

图片需要放置在平台项目(iOS、Android 等)中,而不是共享的 Forms 项目中.有关详细信息,请参阅使用图像.

Images need to be placed in the platform projects (iOS, Android, etc) not the shared Forms project. See Working with Images for details.

图像可以使用 Xamarin.Forms 跨平台共享,它们可以专门为每个平台加载,也可以下载以进行显示."

"Images can be shared across platforms with Xamarin.Forms, they can be loaded specifically for each platform, or they can be downloaded for display."

这篇关于图像- Xamarin.Form的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆