【发布时间】:2020-05-19 02:55:13
【问题描述】:
我有一个绑定图像和文本的列表视图。我一直在尝试在此页面的右下角添加一个浮动按钮,但无济于事。做了一些研究,但似乎仍然没有明确的解决方案。谁知道我可以如何实现这个?在我的 xaml 代码中,我展示了我尝试过的内容。
我的 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="LoyaltyWorx.Page1"
Title="Stores">
<ContentPage.ToolbarItems>
<ToolbarItem Text="About"
Icon="ic_action_more_vert.png"
Priority="0"
Order="Secondary"
Clicked="ToolbarItem_Clicked"/>
<ToolbarItem Text="Settings"
Icon="ic_action_more_vert.png"
Priority="0"
Order="Secondary"/>
</ContentPage.ToolbarItems>
<ListView x:Name="MainListView" HasUnevenRows="True" ItemTapped="MainListView_ItemTapped" SeparatorColor="DarkGray">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell ImageSource="{Binding Image}" Text="{Binding Name}" TextColor="Black" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
***//here is what I attempted but the image just covers the whole page***
<Image Source="add.png"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
HeightRequest="0"
WidthRequest="0"
AbsoluteLayout.LayoutBounds="1,.99, 65, 65"
AbsoluteLayout.LayoutFlags="PositionProportional" >
<Image.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding clickNewCard}"
CommandParameter="3" />
</Image.GestureRecognizers>
</Image>
</ContentPage>
【问题讨论】:
标签: xaml xamarin xamarin.forms