2014-07-09 25 views
0

我有一个简单的问题(在我看来)太困难的解决方案。我想在右上角有一个“主”图像和一些其他“小”图像。喜欢的东西与通知了iOS主屏幕按钮:Xamarin.Forms - 彼此顶部的跨平台图像

iOS home-screen buttons with notifications

有谁知道怎么做这样的事情在Xamarin.Forms方式?

回答

1

我通过使用网格与具有RelativeLayout每一个细胞都解决了。每个广场接收两个孩子:一个按钮和一个图像。由于约束,图像很小并且将移动到右上方RelativeToParent

RelativeLayout relativeLayout = new RelativeLayout(); 
relativeLayout.Children.Add(button, 
         Constraint.Constant(0), 
         Constraint.Constant(0)); 
relativeLayout.Children.Add(image, 
         Constraint.RelativeToParent((parent) => 
         { 
          return parent.Width - 40; 
         }), 
         Constraint.Constant(0));