我知道ListView类没有名为BackgroundImage
的属性 - 只有BackgroundColor
属性,但这不是我想要的。有没有办法将背景图像添加到ListView,以便当我滚动图像时保持原位,并且在滚动时图块只是“移动”在图像上。
将图像添加到ContentPage
也不起作用,因为ListView只是覆盖它。
你的帖子非常好,你只是错过了Source属性上的双引号
将你的ListView
的BackgroundColor
设置为Transparent
:
<RelativeLayout>
<Image Source="background.png"
BackgroundColor="Transparent"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
<ListView x:Name="listView"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
BackgroundColor="Transparent"
ItemTapped="OnItemTapped"
ItemsSource="{Binding .}" />
</RelativeLayout>