Dynamic Element Sizes

This commit is contained in:
2019-07-09 17:08:56 -05:00
parent 60ec28c952
commit 183febe9c0
7 changed files with 44 additions and 27 deletions
+6 -2
View File
@@ -11,7 +11,9 @@ namespace qController
public static string QFont;
public static DisplayInfo mainDisplayInfo;
public static double Height;
public static double Width;
public static double Width;
public static double HeightUnit;
public static double WidthUnit;
public static bool MenuIsPresented
{
get
@@ -33,7 +35,9 @@ namespace qController
mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
Height = mainDisplayInfo.Height / mainDisplayInfo.Density;
Width = mainDisplayInfo.Width / mainDisplayInfo.Density;
Width = mainDisplayInfo.Width / mainDisplayInfo.Density;
HeightUnit = Height / 100.0;
WidthUnit = Width / 100.0;
System.Console.WriteLine(Height);
System.Console.WriteLine(Width);
switch (Device.RuntimePlatform)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:qController" x:Class="qController.QConnectionPage">
<StackLayout x:Name="sLayout">
@@ -10,7 +10,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" FontSize="25"/>
<Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" VerticalOptions="End" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0"/>
</Grid>
<ListView x:Name="lstView" HasUnevenRows = "true" >
</ListView>
@@ -54,10 +54,12 @@ namespace qController
switch (Device.RuntimePlatform)
{
case Device.iOS:
menuButton.Margin = new Thickness(20, 35, 20, 10);
menuButton.Margin =
menuButton.Margin = new Thickness(App.WidthUnit * 2, 0, 0, App.WidthUnit * 2);
menuButton.FontSize = App.Height * .04;
break;
case Device.Android:
topBar.HeightRequest = 50;
topBar.HeightRequest = Math.Max(App.Height * .09, 65);
menuButton.Margin = new Thickness(20, 10, 20, 10);
break;
}