【问题标题】:ViewCell in Xamarin limited height displayedXamarin 中的 ViewCell 显示有限高度
【发布时间】:2016-02-18 13:38:46
【问题描述】:

我已经为 Xamarin 跨平台应用程序中的设置页面实现了 TableView。在这个高度中,每个单元格的高度都是固定的,并且不会根据内部的 View 进行扩展。如果 ViewCell 是单行高或双行高,则 ViewCell 可以很好地显示项目。如果有多个控件(如按钮+2标签或包含段落的标签),则其高度有限,视图不显示。

<TableSection Title="Settings heading">

                <ViewCell>

                    <!--  Image Type Settings  -->
                    <StackLayout HorizontalOptions="StartAndExpand"
                                 Orientation="Vertical"
                                 VerticalOptions="StartAndExpand">
                        <StackLayout HorizontalOptions="Fill"
                                     Orientation="Horizontal"
                                     VerticalOptions="StartAndExpand">
                            <Label HorizontalOptions="StartAndExpand" Text="Key" />
                            <Label HorizontalOptions="EndAndExpand"
                                   Text="Value"
                                   TextColor="Green" />
                        </StackLayout>
                        <Label HorizontalOptions="Fill"
                               Text="---- Long Long Paragraph here about setting, of which only one line will be rendered in ViewCell ----"
                               VerticalOptions="StartAndExpand" />
                    </StackLayout>
                </ViewCell>
 </TableSection>

我尝试增加 ViewCell、TableView VerticalOptions 的高度,但没有任何结果。

【问题讨论】:

    标签: xamarin xamarin.forms


    【解决方案1】:

    后来发现TableView有属性HasUnevenRows,应该设置为true

     HasUnevenRows="True"  
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 2018-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多