旋转后如何修复图像重叠标签

时间:2019-04-24 07:01:10

标签: xaml user-interface xamarin.forms

旋转图像后,UI在android和iOS上执行此操作(橙色部分是图像): Image Overlap

图像与某些标签重叠,并在其他标签后面。通常,图像正在侵入标签的空间。有什么想法可以解决吗? 这是我的Xaml代码:

<?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:maps="clr- 
   namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
         x:Class="App3.ItemScreen"
         xmlns:views="clr-namespace:App3">
<ContentPage.Content>
    <ScrollView>
        <StackLayout BackgroundColor="Black">
            <views:TopMenu x:Name="myTopMenu" HeightRequest="50" WidthRequest="200" />
            <Label x:Name="LBL_Title" BackgroundColor="#007374" TextColor="White" HeightRequest="20" />
            <Label x:Name="LBL_ItemPrice" BackgroundColor="#007374" TextColor="White" HeightRequest="20" />
            <Image x:Name="mainImage" HeightRequest="200" />
            <Label x:Name="LBL_Descr" BackgroundColor="#007374" TextColor="White" />
            <Grid>
                <Label Text="Available:" Grid.Row="0" Grid.Column="0" BackgroundColor="#007374" TextColor="White" />
                <Label x:Name="LBL_IsAvail" Grid.Row="0" Grid.Column="1" BackgroundColor="#007374" TextColor="White" />
            </Grid>
            <Label x:Name="LBL_CityAndZip" BackgroundColor="#007374" TextColor="White" />
            <maps:Map WidthRequest="320" HeightRequest="150" x:Name="MyMap" MapType="Street" />
            <Grid>
                <Label Text="Category:" Grid.Row="0" Grid.Column="0" BackgroundColor="#007374" TextColor="White" />
                <Label x:Name="LBL_Category" Grid.Row="0" Grid.Column="1" BackgroundColor="#007374" TextColor="White" />
                </Grid>
                <Button Text="Make Offer" Clicked="BT_MakeOffer_Clicked" BackgroundColor="#002829" TextColor="White" />
                <Button Text="Edit" Clicked="BT_Edit_Clicked" x:Name="BT_Edit" IsVisible="False" BackgroundColor="#002829" TextColor="White" />
            </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>

我的一个想法是将UI移至CS代码,并在旋转后将视图添加到堆栈中。我现在正试图避免这种情况。

1 个答案:

答案 0 :(得分:0)

我解决此问题的方法是完全不旋转此屏幕上的图像。在将图像传递到屏幕之前,我正在旋转图像。