【问题标题】:How to use TableView in Xamarin.Forms?如何在 Xamarin.Forms 中使用 TableView?
【发布时间】:2018-12-10 19:38:56
【问题描述】:

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

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

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

提前致谢。

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

【问题讨论】:

    标签: xaml xamarin xamarin.forms


    【解决方案1】:

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

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

    <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 无法使用单元格末尾的箭头和安全部分下方的页脚文本,这可能需要您编写自定义渲染器。

    【讨论】:

    • 我同意。当我单击一个单元格时,我无法弄清楚导航的能力。
    • 我的困惑是,它会自动在 ios 上添加右箭头还是我需要做点什么?
    • 它不会自动添加,它们被称为附件(developer.apple.com/design/human-interface-guidelines/ios/views/…),如果你需要这些,你需要创建一个自定义渲染器
    • 你能分享一个例子吗?我正在开发适用于 Android 和 iOS 的应用程序,因此它必须同时在两者上运行
    • 这两个都不起作用,因为这是 iOS 特定的。如果你想在两者上都使用它,你必须自己设计一个箭头图标,并在单元格的末尾绘制。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 2013-07-06
    • 1970-01-01
    相关资源
    最近更新 更多