Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Trouble with images and lists with images

$
0
0

So, one page I'm trying to set an image to fill the background and stretch. everywhere i read " Aspect="Fill"" is suppose to do it but my image just sits in the top left. i can't figure out why.

<AbsoluteLayout>
        <Image Source="{local:ImageResource Emu_alexandra_park.png}" Aspect="Fill"/>
        <Label Text="Welcome to &#x0a;The Bundy Book&#x0a; App!" FontSize="Large" TextColor="Red"  XAlign="Center"
               AbsoluteLayout.LayoutBounds=".5,.4" AbsoluteLayout.LayoutFlags="PositionProportional"/>
        <Button
            x:Name="ExploreButton"
            Text=" Explore "
            TextColor="White"
            BackgroundColor="#007Aff"
            BorderRadius="10"
            AbsoluteLayout.LayoutBounds=".5,.75" AbsoluteLayout.LayoutFlags="PositionProportional"
            Clicked="Button_clicked"/>
    </AbsoluteLayout>

another issue im having is having a list row fill to fit the image. The images are either crushed or overlap i can't see how to make each image fill the space.
also "Image1" has it's width stretched to fill the width of the phone but the hight of the image is cropped out and i lose half my image.

    <ScrollView>
            <StackLayout x:Name="singlePlaceView" Margin="20,10,20,10">
                <Label  x:Name="Title"
                    Text="{Binding Name}" FontSize="Large" XAlign="Center"
                    HorizontalOptions="Center" TextColor="Red"/>
                <Image x:Name="Image1" Source="{Binding Image1Source}" Aspect="AspectFill"/>
                <Label  x:Name="Description1"
                    Text="{Binding Description1}" TextColor="DarkBlue"
                HorizontalOptions="CenterAndExpand" />
                <Image x:Name="Image2" Source="{Binding Image2Source}" Aspect="AspectFill" HorizontalOptions="CenterAndExpand"/>
                <Label  x:Name="Description2"
                    Text="{Binding Description2}" TextColor="DarkBlue"
                HorizontalOptions="CenterAndExpand" />
                <ListView x:Name="ListOfAdds" ItemSelected="OnAddItemSelected" HasUnevenRows="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <StackLayout>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Image Source="{Binding ImageSource}" Aspect="AspectFill"/>
                                    </Grid>
                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </ScrollView>

how do i make an image fill the background?
how do i get an image to take up it's actual highet and width? please note this is a template page so must be usable with different size images
how do i get the last question working inside a list view?
also, how do i stop all the excess white space created from a list view? especailly if the list ends up empty. its a template and not all events adds at the bottom. I say adds by they are more like coupons/discounts.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>