2016-08-02 15 views
1

デバイスがLandscapeのときに、stacklayoutはすべての画面幅を取ることができますか?ここ in Landscape mode stacklayout does not fill parentXamarinフォームstacklayoutで画面を塗りつぶす

は私の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:local="clr-namespace:ListView" 
     x:Class="ListView.MainPage"> 
<ContentPage.Content> 
     <AbsoluteLayout BackgroundColor="Silver" HorizontalOptions="FillAndExpand"> 
     <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" BackgroundColor="Maroon" VerticalOptions="StartAndExpand"> 
      <Button Text="Reload data" Clicked="reloadData" x:Name="btnReload"/> 
      <ListView x:Name="listView"> 
       <ListView.ItemTemplate> 
        <DataTemplate> 
         <ViewCell> 
          <StackLayout BackgroundColor="#eee" Orientation="Vertical"> 
           <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand"> 
            <Image Source="{Binding Imagen}" HeightRequest="100" WidthRequest="120"/> 
            <Label Text="{Binding Titulo}" TextColor="Gray"/> 
            <Label Text="{Binding Fecha}" HorizontalOptions="EndAndExpand"/> 
           </StackLayout> 
          </StackLayout> 
         </ViewCell> 
        </DataTemplate> 
       </ListView.ItemTemplate> 
      </ListView> 
     </StackLayout> 
     <ActivityIndicator BackgroundColor="Green" AbsoluteLayout.LayoutBounds=".5,.5,.2,.2" AbsoluteLayout.LayoutFlags="All" Color="Blue" 
          IsRunning="True" IsVisible="False" x:Name="overlay"/> 
    </AbsoluteLayout> 
</ContentPage.Content> 

私が風景に画面幅を取るstacklayoutたいです。肖像画だけが仕事です。

答えて

2

コントロールがAbsoluteLayoutの直接の子である場合、HorizontalOptionsVerticalOptionsは効果がありません。すべてのサイジングは、AbsoluteLayout.LayoutBoundsAbsoluteLayout.LayoutFlagsに設定する必要があります。だからあなたStackLayoutこれに変更してみてください:

<AbsoluteLayout BackgroundColor="Silver" 
       HorizontalOptions="FillAndExpand"> 
    <StackLayout Orientation="Vertical" 
       BackgroundColor="Maroon" 
       AbsoluteLayout.LayoutBounds="0,0,1,1" 
       AbsoluteLayout.LayoutFlags="All"> 
    ... 

は、その後、あなたもあなたのListView.HorizontalOptionsFillAndExpandに設定されていますが、その最初のせずに試してみる必要があるかもしれません。

+0

現在作業中です:)本当に明確な答えです。ありがとうございました –

+0

@EricOcampo全く問題ありません。うれしいことはあなたのために働いた。 – hvaughan3

関連する問題