本文整理汇总了C#中AbsoluteLayout类的典型用法代码示例。如果您正苦于以下问题:C# AbsoluteLayout类的具体用法?C# AbsoluteLayout怎么用?C# AbsoluteLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbsoluteLayout类属于命名空间,在下文中一共展示了AbsoluteLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeComponent
private void InitializeComponent() {
this.LoadFromXaml(typeof(StandingsView));
NameGrid = this.FindByName<Grid>("NameGrid");
MessagesLayoutFrame = this.FindByName<AbsoluteLayout>("MessagesLayoutFrame");
MessagesLayoutFrameInner = this.FindByName<ContentView>("MessagesLayoutFrameInner");
MessagesListView = this.FindByName<ListView>("MessagesListView");
}
示例2: ClockPage
public ClockPage()
{
AbsoluteLayout absoluteLayout = new AbsoluteLayout();
for (int i = 0; i < tickMarks.Length; i++)
{
tickMarks[i] = new BoxView
{
Color = Color.Accent
};
absoluteLayout.Children.Add(tickMarks[i]);
}
absoluteLayout.Children.Add(hourHand =
new BoxView
{
Color = Color.Accent
});
absoluteLayout.Children.Add(minuteHand =
new BoxView
{
Color = Color.Accent
});
absoluteLayout.Children.Add(secondHand =
new BoxView
{
Color = Color.Red
});
Content = absoluteLayout;
Device.StartTimer(TimeSpan.FromMilliseconds(16), OnTimerTick);
SizeChanged += OnPageSizeChanged;
}
示例3: CircularTextPage
public CircularTextPage()
{
// Create the AbsoluteLayout.
absoluteLayout = new AbsoluteLayout();
absoluteLayout.SizeChanged += (sender, args) =>
{
LayOutLabels();
};
Content = absoluteLayout;
// Create the Labels.
string text = "Xamarin.Forms makes me want to code more with ";
labels = new Label[text.Length];
double fontSize = 1.5 * Device.GetNamedSize(NamedSize.Large, typeof(Label));
int countSized = 0;
for (int index = 0; index < text.Length; index++)
{
char ch = text[index];
Label label = new Label
{
Text = ch == ' ' ? "\u00A0" : ch.ToString(),
FontSize = fontSize,
};
label.SizeChanged += (sender, args) =>
{
if (++countSized >= labels.Length)
LayOutLabels();
};
labels[index] = label;
absoluteLayout.Children.Add(label);
}
}
示例4: InitializeCell
protected override void InitializeCell ()
{
var width = CellWidth;
var height = CellHeight;
_titleLabel = new Label ();
AbsoluteLayout simpleLayout = new AbsoluteLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
WidthRequest = CellWidth,
HeightRequest = CellHeight,
};
_image = new FastImage () {
Aspect = Aspect.AspectFill,
BackgroundColor = Color.Black,
};
_titleLabel = new Label {
Text = "",
TextColor = Color.White,
FontSize = 14,
XAlign = TextAlignment.Center,
YAlign = TextAlignment.Center,
LineBreakMode = LineBreakMode.TailTruncation,
BackgroundColor = Color.FromHex ("#272727"),
};
simpleLayout.Children.Add (_image, new Rectangle (0, 0, width, height - 30));
simpleLayout.Children.Add (_titleLabel, new Rectangle (0, height - 30, width, 30));
View = simpleLayout;
}
示例5: OptionsContentCell
public OptionsContentCell()
{
var labelName = new Label
{
Text = "Texto principal",
TextColor = Color.Black,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.StartAndExpand,
FontFamily = Device.OnPlatform("GillSans", "Quattrocento Sans", "Comic Sans MS")
};
labelName.SetBinding(Label.TextProperty, "Text");
StackLayout stack = new StackLayout
{
Orientation = StackOrientation.Horizontal,
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = new Thickness(5, 0, 0, 0),
Children = { labelName }
};
var absoluteLayout = new AbsoluteLayout();
var background = new Image
{
Style = Styles.CellBackground
};
absoluteLayout.Children.Add(background, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
absoluteLayout.Children.Add(stack, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
View = absoluteLayout;
}
示例6: AbsoluteLayoutExample
public AbsoluteLayoutExample()
{
Label red = new Label
{
Text = "Stop",
BackgroundColor = Color.Red,
FontSize = 20,
WidthRequest = 200,
HeightRequest = 30
};
Label yellow = new Label
{
Text = "Slow down",
BackgroundColor = Color.Yellow,
FontSize = 20,
WidthRequest = 160,
HeightRequest = 160
};
Label green = new Label
{
Text = "Go",
BackgroundColor = Color.Green,
FontSize = 20,
WidthRequest = 50,
HeightRequest = 50
};
AbsoluteLayout absLayout = new AbsoluteLayout();
absLayout.Children.Add(red, new Point(20, 20));
absLayout.Children.Add(yellow, new Point(40, 60));
absLayout.Children.Add(green, new Point(80, 180));
Content = absLayout;
}
示例7: AbsoluteLayoutPageCode
public AbsoluteLayoutPageCode ()
{
Title = "AbsoluteLayout - C#";
BackgroundImage = "deer.jpg";
var outerLayout = new AbsoluteLayout ();
var scroll = new ScrollView ();
outerLayout.Children.Add (scroll, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
outerLayout.Children.Add (new Button {
Text = "Previous",
BackgroundColor = Color.White,
TextColor = Color.Green,
BorderRadius = 0
}, new Rectangle (0, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
outerLayout.Children.Add (new Button {
Text = "Next",
BackgroundColor = Color.White,
TextColor = Color.Green,
BorderRadius = 0
}, new Rectangle (1, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
var innerLayout = new AbsoluteLayout ();
scroll.Content = innerLayout;
innerLayout.Children.Add (new Image { Source = "deer.jpg" }, new Rectangle (.5, 0, 300, 300), AbsoluteLayoutFlags.PositionProportional);
innerLayout.Children.Add (new BoxView { Color = Color.FromHex ("#CC1A7019") }, new Rectangle (.5, 300, .7, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional);
innerLayout.Children.Add (new Label { Text = "deer.jpg", XAlign = TextAlignment.Center, TextColor = Color.White }, new Rectangle (.5, 310, 1, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional);
Content = outerLayout;
}
示例8: GerenciarFeriadosView
public GerenciarFeriadosView(GerenciarFeriadosViewModel viewModel)
{
Title = "Feriados";
BindingContext = viewModel;
this.SetBinding(ContentPage.NavigationProperty, "Navigation", BindingMode.TwoWay);
// message.SetBinding(Label.IsVisibleProperty, "messageVisibility", BindingMode.TwoWay);
listViewHolidays.SetBinding(ListView.ItemsSourceProperty, "holidays", BindingMode.TwoWay);
listViewHolidays.ItemTemplate = new DataTemplate(typeof(TwoColumnsGridCell));
listViewHolidays.ItemTapped += listViewHolidays_ItemTapped;
FloatButton.AnimateWithAction();
FloatButton.Command = new Command(toolbarAddHoliday);
/*ToolbarItems.Add(new ToolbarItem
{
Icon = Images.Add2,
Order = ToolbarItemOrder.Primary,
Command = new Command(toolbarAddHoliday)
});*/
iconStack = new StackLayout
{
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
Children = { iconMsg, message }
};
stack = new StackLayout
{
Padding = new Thickness(0, 15, 0, 0),
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.FromHex("#ECEFF1"),
Children = { listViewHolidays }
};
var absoluteLayout = new AbsoluteLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
};
//var background = new Image { Source = Images.Background, Aspect = Aspect.Fill };
//absoluteLayout.Children.Add (background, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
//AbsoluteLayout.SetLayoutFlags(background, AbsoluteLayoutFlags.All);
//AbsoluteLayout.SetLayoutBounds(background, new Rectangle(0, 0, 1, 1));
//absoluteLayout.Children.Add (stack, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutFlags(stack, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(stack, new Rectangle(0, 0, 1, 1));
//absoluteLayout.Children.Add (Add, new Rectangle (0.85, 0.85, 0.185, 0.1), AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutFlags(FloatButton, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(FloatButton, new Rectangle(0.99f, 0.98f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
//absoluteLayout.Children.Add(background);
absoluteLayout.Children.Add(stack);
absoluteLayout.Children.Add(FloatButton);
Content = absoluteLayout;
}
示例9: RotateAnimationWithAnchorsPageCS
public RotateAnimationWithAnchorsPageCS ()
{
Title = "Rotate Animation with Anchors";
image = new Image { Source = ImageSource.FromFile ("monkey.png"), VerticalOptions = LayoutOptions.EndAndExpand };
startButton = new Button { Text = "Start Animation", VerticalOptions = LayoutOptions.End };
cancelButton = new Button { Text = "Cancel Animation", IsEnabled = false };
image.SizeChanged += OnImageSizeChanged;
startButton.Clicked += OnStartAnimationButtonClicked;
cancelButton.Clicked += OnCancelAnimationButtonClicked;
absoluteLayout = new AbsoluteLayout ();
absoluteLayout.Children.Add (image);
var stackLayout = new StackLayout {
Children = {
startButton,
cancelButton
}
};
var grid = new Grid {
RowDefinitions = {
new RowDefinition { Height = new GridLength (0.8, GridUnitType.Star) },
new RowDefinition { Height = new GridLength (0.2, GridUnitType.Star) }
},
Children = {
absoluteLayout,
}
};
grid.Children.Add (stackLayout, 0, 1);
Content = grid;
}
示例10: MyAbsoluteLayout
public MyAbsoluteLayout ()
{
var red = new Label {
Text = "Stop",
BackgroundColor = Color.Red,
Font = Font.SystemFontOfSize (20),
WidthRequest = 200, HeightRequest = 30
};
var yellow = new Label {
Text = "Slow down",
BackgroundColor = Color.Yellow,
Font = Font.SystemFontOfSize (20),
WidthRequest = 160, HeightRequest = 160
};
var green = new Label {
Text = "Go",
BackgroundColor = Color.Green,
Font = Font.SystemFontOfSize (20),
WidthRequest = 50, HeightRequest = 50
};
var absLayout = new AbsoluteLayout ();
absLayout.Children.Add (red, new Point (20, 20));
absLayout.Children.Add (yellow, new Point (40, 60));
absLayout.Children.Add (green, new Point (80, 180));
Content = absLayout;
}
示例11: AboutPage
public AboutPage()
{
Title = "Informacoes";
// GetValue ();
var stack = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Children = {
lbInformation
}
};
var scroll = new ScrollView {
BackgroundColor = Colors.BackgroundDefault,
Content = stack
};
var absoluteLayout = new AbsoluteLayout ();
var background = new Image {
Style = Styles.BackgroundImage
};
absoluteLayout.Children.Add (background, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
absoluteLayout.Children.Add (scroll, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
Content = absoluteLayout;
}
示例12: AbsoluteLayoutExplorationCode
public AbsoluteLayoutExplorationCode ()
{
Title = "Absolute Layout Exploration - C#";
var layout = new AbsoluteLayout();
var centerLabel = new Label {Text = "I'm centered on iPhone 4 but no other device.", LineBreakMode = LineBreakMode.WordWrap, FontSize = 20};
AbsoluteLayout.SetLayoutBounds (centerLabel, new Rectangle (115, 159, 100, 100));
// it is not necessary to set layout flags because absolute positioning is the default
var bottomLabel = new Label { Text = "I'm bottom center on every device.", LineBreakMode = LineBreakMode.WordWrap };
AbsoluteLayout.SetLayoutBounds (bottomLabel, new Rectangle (.5, 1, .5, .1));
AbsoluteLayout.SetLayoutFlags (bottomLabel, AbsoluteLayoutFlags.All);
var rightBox = new BoxView{ Color = Color.Olive };
AbsoluteLayout.SetLayoutBounds (rightBox, new Rectangle (1, .5, 25, 100));
AbsoluteLayout.SetLayoutFlags (rightBox, AbsoluteLayoutFlags.PositionProportional);
var leftBox = new BoxView{ Color = Color.Red };
AbsoluteLayout.SetLayoutBounds (leftBox, new Rectangle (0, .5, 25, 100));
AbsoluteLayout.SetLayoutFlags (leftBox, AbsoluteLayoutFlags.PositionProportional);
var topBox = new BoxView{ Color = Color.Blue };
AbsoluteLayout.SetLayoutBounds (topBox, new Rectangle (.5, 0, 100, 25));
AbsoluteLayout.SetLayoutFlags (topBox, AbsoluteLayoutFlags.PositionProportional);
layout.Children.Add (bottomLabel);
layout.Children.Add (centerLabel);
layout.Children.Add (rightBox);
layout.Children.Add (leftBox);
layout.Children.Add (topBox);
Content = layout;
}
示例13: Init
protected override void Init ()
{
AbsoluteLayout layout = new AbsoluteLayout {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
};
BackgroundColor = Color.FromUint (0xFFDBDBDB);
_btnLogin = new Button {
HorizontalOptions = LayoutOptions.FillAndExpand,
Text = "Press me",
BackgroundColor = Color.FromUint (0xFF6E932D),
TextColor = Color.White,
};
_btnLogin.Clicked += BtnLogin_Clicked;
layout.Children.Add (_btnLogin, new Rectangle (0.5f, 0.5f, 0.25f, 0.25f), AbsoluteLayoutFlags.All);
_busyBackground = new BoxView {
BackgroundColor = new Color (0, 0, 0, 0.5f),
IsVisible = false,
InputTransparent = false
};
layout.Children.Add (_busyBackground, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.SizeProportional);
Content = layout;
}
示例14: FlowListViewInternalCell
/// <summary>
/// Initializes a new instance of the <see cref="DLToolkit.Forms.Controls.FlowListViewInternalCell"/> class.
/// </summary>
/// <param name="flowListViewRef">Flow list view reference.</param>
public FlowListViewInternalCell(WeakReference<FlowListView> flowListViewRef)
{
_flowListViewRef = flowListViewRef;
FlowListView flowListView = null;
flowListViewRef.TryGetTarget(out flowListView);
_useGridAsMainRoot = !flowListView.FlowUseAbsoluteLayoutInternally;
if (!_useGridAsMainRoot)
{
_rootLayout = new AbsoluteLayout()
{
Padding = 0d,
BackgroundColor = flowListView.FlowRowBackgroundColor,
};
View = _rootLayout;
}
else
{
_rootLayoutAuto = new Grid()
{
RowSpacing = 0d,
ColumnSpacing = 0d,
Padding = 0d,
BackgroundColor = flowListView.FlowRowBackgroundColor,
};
View = _rootLayoutAuto;
}
_flowColumnTemplate = flowListView.FlowColumnTemplate;
_desiredColumnCount = flowListView.DesiredColumnCount;
_flowColumnExpand = flowListView.FlowColumnExpand;
}
示例15: StackLayoutAbsolute
public StackLayoutAbsolute ()
{
AbsoluteLayout absoluteLayout = new AbsoluteLayout
{
VerticalOptions = LayoutOptions.FillAndExpand
};
Label firstlabel = new Label
{
Text = "FirstLabel"
};
Label secondlabel = new Label
{
Text = "SecondLabel"
};
absoluteLayout.Children.Add (secondlabel);
AbsoluteLayout.SetLayoutFlags (secondlabel,
AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds (secondlabel,
new Rectangle (0, 1, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
absoluteLayout.Children.Add (firstlabel);
AbsoluteLayout.SetLayoutFlags (firstlabel,
AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds (firstlabel,
new Rectangle (0,0, AbsoluteLayout.AutoSize,AbsoluteLayout.AutoSize));
this.Content = absoluteLayout;
}