【发布时间】:2021-01-05 02:04:39
【问题描述】:
我有一个关于 X.Forms 的问题。有谁知道我如何在 X.Forms 中构建这样的页面?
页面流程: 用户必须能够创建注释和/或进行更改。我想在另一个下方显示这些注释(最好在可滚动的列表视图中)。
这是我的代码实现,但运行不正常。
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.TestPage">
<ContentPage.Content>
<AbsoluteLayout BackgroundColor="LightGray" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Blue" AbsoluteLayout.LayoutBounds="1,0,1,0.1" AbsoluteLayout.LayoutFlags="All" />
<StackLayout AbsoluteLayout.LayoutBounds="1,1,1,0.9" AbsoluteLayout.LayoutFlags="All" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="LightGray"/>
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame>
<Editor></Editor>
<Button x:Name="CreateOrChangeButton" Text="Create/Change" Clicked=""></Button>
<Button x:Name="DeleteButton" Text="Delete" Clicked=""></Button>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>
【问题讨论】:
-
试过 GridView?
-
创建一个看起来像您图像中的模板的 ViewCell。您应该使用 stacklayout 或 grid 在 Frame 内布局视图。
-
@JackHua-MSFT 你有样品(代码)吗?
标签: xamarin.forms cardview absolutelayout content-pages