【问题标题】:listview organization xamarin formslistview 组织 xamarin 表单
【发布时间】:2017-10-04 13:10:31
【问题描述】:

每当应用程序打开并且页脚位于末尾时,我的列表视图中有以下顺序,因为他要留在项目的中间

        <ListView.Header>
            //First item
        </ListView.Header>

        <ListView.Footer>
             //second item
        </ListView.Footer>

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
             //third item
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

</ContentPage.Content>

【问题讨论】:

  • A Footer 很好,是一个 footer 并将位于您的列表视图的末尾,确实想要在标题(即子标题)之后的东西还是你是指所有列表视图项中间的 UI 元素?
  • 我猜你做错了,伙计......页眉和页脚部分旨在分别将列表的内容包装在其内容的顶部和底部......有没有我们可以提供帮助的实际场景?
  • 这甚至是我想要的子标题@SushiHangover

标签: xamarin xamarin.forms


【解决方案1】:

我想要的副标题

您可以为您的ListView 创建一个自定义 标头,其中包含您需要的任何元素:

<ListView.Header>
    <StackLayout Orientation="Horizontal">
        <Label Text="Header" TextColor="Green" />
        <Label Text="SubHeader" TextColor="Red" />
    </StackLayout>
</ListView.Header>

如果您想要一个不随列表滚动的“粘性”标题,您可以将元素放在 ListView 上方:

<StackLayout Orientation="Vertical" >
    <StackLayout Orientation="Vertical">
        <Label Text="Header" TextColor="Green" />
        <Label Text="SubHeader" TextColor="Red" />
    </StackLayout>
    <ListView>
        ~~~~~
    </ListView>
</StackLayout>

【讨论】:

    猜你喜欢
    • 2020-02-07
    • 2021-06-12
    • 2018-03-11
    • 2016-10-10
    • 2018-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多