首页 > 解决方案 > 如何在 Xamarin.Forms 中使用 TableView?

问题描述

我对 Xamarin.Forms 的世界比较陌生,并且对 Xamarin TableView 有疑问。

我想创建一个类似于下图的布局。

Xamarin TableView 所需的布局

问题是,我可以为此使用TableView还是有其他选择?任何人都可以用 XAML 代码显示这个吗?

提前致谢。

编辑:底部的标签不是必需的。

标签: xamlxamarinxamarin.forms

解决方案


我并不是要粗鲁,但这很容易从文档页面中检索到,并且自己尝试一下。

为了让你开始,试试这个:

<TableView Intent="Settings">
    <TableView.Root>
        <TableView.Section>
            <ImageCell Text="Invoice Customization" Source="Invoice_image.png" />
            <ImageCell Text="Invoice Defaults" Source="Invoice_image.png" />
        </TableView.Section>
        <TableView.Section Title="Security">
            <SwitchCell Text="Use Touch ID" />
        </TableView.Section>
        ... etc.
   </TableView.Root>
</TableView>

开箱即用的 Xamarin.Forms 无法使用单元格末尾的箭头和安全部分下方的页脚文本,这可能需要您编写自定义渲染器。


推荐阅读