本文整理汇总了C#中RelativeLayout.FadeTo方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.FadeTo方法的具体用法?C# RelativeLayout.FadeTo怎么用?C# RelativeLayout.FadeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.FadeTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPopup
/// <summary>
/// Show a view as
/// </summary>
/// <param name="view">The view to be displayed as popup</param>
/// <returns>
/// </returns>
/// <exception cref="System.ArgumentNullException">The <paramref name="view" /> is <c>null</c>.</exception>
public async Task<bool> ShowPopup(View view)
{
Argument.IsNotNull(() => view);
await DismissPopup();
_popupView = view;
_content.InputTransparent = true;
var backdrop = new RelativeLayout
{
BackgroundColor = Color.FromRgba(0, 0, 0, 0.4),
Opacity = 1,
GestureRecognizers =
{
new TapGestureRecognizer()
}
};
if (_popupView.BackgroundColor == Color.Default)
{
_popupView.BackgroundColor = Color.FromRgb(40, 40, 40);
}
if (_popupView.WidthRequest < 0)
{
_popupView.WidthRequest = Width;
}
if (_popupView.HeightRequest < 0)
{
_popupView.HeightRequest = Height;
}
backdrop.Children.Add(_popupView,
Constraint.RelativeToParent(p => Width/2 - _popupView.WidthRequest/2),
Constraint.RelativeToParent(p => Height/2 - _popupView.HeightRequest/2),
Constraint.RelativeToParent(p => _popupView.WidthRequest),
Constraint.RelativeToParent(p => _popupView.HeightRequest));
_backdrop = backdrop;
Children.Add(backdrop, Constraint.Constant(0), Constraint.Constant(0),
Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height));
UpdateChildrenLayout();
return await _backdrop.FadeTo(1);
}