Ich arbeite an einer Forms App und ich frage mich nur, ob mir jemand mit Geräteausrichtung und -rotation helfen könnte.Xamarin Forms Geräteausrichtung
Grundsätzlich habe ich im Moment drei Reihen von Bildschaltflächen. Was ich tun möchte, ist, wenn das Gerät in Querformat gedreht wird, dann werden alle Knöpfe alle auf einer horizontalen Linie anstelle von 3 vertikalen Reihen angezeigt.
Was wäre der beste Ansatz dafür? Ich weiß in Android Sie nur eine andere XML-Layout-Datei erstellen und nur verweisen, gibt es eine ähnliche Möglichkeit, das in Xamarin Forms und XAML zu tun?
Ich werde mein MainPage.xaml unten liefern:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp_Crossplatform.Views.MainPage"
Title="App"
BackgroundColor="White">
<ContentPage.Content>
<StackLayout Padding="10" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Orientation="Vertical">
<!--Main container layout-->
<StackLayout VerticalOptions="Fill" HorizontalOptions="Center" Orientation="Vertical">
<!--Layout for each menu component-->
<StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand" Orientation="Horizontal">
<Image
x:Name="btnSocial"
Source="imgsocial.png"
WidthRequest="100"
HeightRequest="100"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
<Image
x:Name="btnCareer"
Source="imgcareer.png"
WidthRequest="100"
HeightRequest="100"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand" Orientation="Horizontal">
<Image
x:Name="btnSchedule"
Source="imgschedule.png"
WidthRequest="100"
HeightRequest="100"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
<Image
x:Name="btnContact"
Source="contact.png"
WidthRequest="100"
HeightRequest="100"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<StackLayout VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand" Orientation="Horizontal">
<Image
x:Name="btnDetails"
Source="imgdetails.png"
WidthRequest="100"
HeightRequest="100"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
</StackLayout>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Wenn jemand, dass wäre toll helfen kann.
Dies wird hier ausführlich erklärt: https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/device-orientation/ –