2017-07-30 21 views
0

黄色の背景とテキスト付きの1つのオレンジ色のボックスと、中位のサイズの画像の後にあるセルを実行しますが、動作しません。画像は、大きな表示されませんし、私は余裕セルには完全な画像が表示されません

これはこれは悪い結果(2項目である私の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" 
     x:Class="neoFly_Montana.Views.PromocoesView" 
     BackgroundImage="promocoesbackground" 
     Title="Promoções"> 
<ContentPage.Content> 
    <ListView x:Name="listview_promocoes" Margin="0, 20, 0, 0 "> 
      <ListView.ItemTemplate> 
       <DataTemplate> 
       <ViewCell> 

        <StackLayout BackgroundColor="AliceBlue" HorizontalOptions="Center" VerticalOptions="FillAndExpand"> 
         <Label Text="{Binding titulo}" Style="{StaticResource labelsfont}"/> 

         <Image Source="{Binding imagem}" Aspect="AspectFill"/> 
        </StackLayout> 


       </ViewCell> 


      </DataTemplate> 
     </ListView.ItemTemplate> 
    </ListView> 


</ContentPage.Content> 

で使用することはできません - uが見ることができないが画像)

enter image description here

私はこのような何かをしたいが、私はそれを使用する場合、アプリが動作しないので、私は余裕を使用することはできません。

enter image description here

これは、リストビューの1つの項目である必要があります。 すべての項目はこのようにする必要があります。

どうすればいいですか? ありがとうございます。

答えて

2

あなたはこのようなものを使用してListView項目でそのレイアウトを取得することができます:

<ListView 
     RowHeight="170" 
     ItemsSource="{Binding Items}"> 
    <ListView.ItemTemplate> 
     <DataTemplate> 
     <ViewCell> 
      <!-- Outter box containing two boxes --> 
      <StackLayout 
         VerticalOptions="FillAndExpand"> 
       <!-- First box with Title, Image and Text --> 
       <StackLayout 
          VerticalOptions="FillAndExpand" 
          Padding="10, 5" 
          BackgroundColor="Yellow"> 
        <Label 
          Text="YOUR_TITLE" 
          BackgroundColor="Silver"/> 
        <Image 
          HorizontalOptions="FillAndExpand" 
          BackgroundColor="Fuchsia" 
          HeightRequest="60" /> 
        <Label 
          Text="YOUR_OTHER_TEXT" 
          BackgroundColor="Silver"/> 
       </StackLayout> 

       <!-- Second box with Text --> 
       <StackLayout 
          VerticalOptions="End" 
          Margin="0, 8, 0, 0" 
          Padding="10, 5" 
          BackgroundColor="Lime"> 
        <Label 
          Text="YOUR_TEXT_OTHER_BOX" 
          BackgroundColor="Silver"/> 
       </StackLayout> 
      </StackLayout> 
     </ViewCell> 
     </DataTemplate> 
    </ListView.ItemTemplate> 
</ListView> 

は、私はあなたがそれをしたいが、これはかなり近いので、正確にそれを得るために、いくつかの小さな変更を行う必要があるかもしれませんね。

結果:

enter image description here

・ホープ、このhelps.-

+0

私はここに掲載の写真のように..私はそれを使用しますが、私のイメージは、再び大きなイマイチ。 uはできます 私のアプリの画像のほんの一部を見る/ 私は何が起こっているのかわかりません... –

+0

私のアプリではそれがラインと思われます:/ –

+0

今働いた ありがとうとても –

関連する問題