为什么我的Xamarin TableView行有不同的高度?

问题描述 投票:0回答:1

复制示例

  1. 在Visual Studio 2019(16.5.4)中创建一个新的Xamarin Forms项目。
  2. 用以下内容替换主页面的ContentPage元素的内容。

    <TableView HasUnevenRows="False" RowHeight="50">
        <TableRoot>
            <TableSection Title="MySection">
                <EntryCell Label="Entry Cell 1" />
                <EntryCell Label="Entry Cell 2" />
                <ViewCell>
                    <Label>View Cell 1</Label>
                </ViewCell>
                <ViewCell>
                    <Label>View Cell 2</Label>
                </ViewCell>
            </TableSection>
        </TableRoot>
    </TableView>
    
  3. 在你喜欢的Android模拟器中运行。

预期的结果

TableView中的所有行都有相同的高度。毕竟。HasUnevenRowsFalseRowHeight 已明确设置。

实际结果

高度不同。入口单元格比视图单元格高很多。 The entry cells are significantly higher than the view cells.

Screenshot

是我做错了什么,还是我发现了一个bug?

xaml xamarin.forms tableview
1个回答
1
投票

我想是因为 参赛细胞 含有 LabelEntry,它将有一个默认的最小高度,似乎大于50,你可以尝试改变的 RowHeight 如果你设置的高度大于他默认的最小值,就会显示为viewcell一样高,你可以尝试把高度设置大一些,比如60。

© www.soinside.com 2019 - 2024. All rights reserved.