【问题标题】:Xamarin: How do I place an image on top of another image at a specific pixel locationXamarin:如何将图像放置在特定像素位置的另一个图像之上
【发布时间】:2018-03-17 15:11:50
【问题描述】:

我有一个需要使用 Xamarin for iOS 构建的应用程序。我目前正在使用 Xamarin.Forms。

该应用程序是一个花园的自定义视图,我需要在管理员中放置植物标记。我找不到一种方法来合成这些图像,使我可以从数据库中驱动显示并使标记可点击。

感谢任何帮助或指导。

【问题讨论】:

  • 如果要将项目放置在特定位置,请使用 AbsoluteLayout 容器。您的花园图像将成为布局的背景。

标签: c# image xamarin xamarin.forms location


【解决方案1】:

在这种情况下你需要使用AbsoluteLayout

var layout = new AbsoluteLayout();

var image = new Image { Source = "foo.png" };                                     
AbsoluteLayout.SetLayoutBounds (image , new Rectangle (.5, 1, .5, .1)); 
                                                   //("X, Y, Width, Height")

layout.Children.Add (bottomLabel);

Content = layout;

这里只是一个从 c# 放置图像的示例,您可以根据自己的要求自定义它

【讨论】:

    猜你喜欢
    • 2015-06-06
    • 1970-01-01
    • 1970-01-01
    • 2012-08-02
    • 2010-09-08
    • 2013-01-29
    • 2016-09-16
    • 1970-01-01
    • 2012-04-27
    相关资源
    最近更新 更多