【问题标题】:NavigationPage with iOS PrefersLargeTitles snaps title when scrolling带有 iOS PrefersLargeTitles 的 NavigationPage 在滚动时捕捉标题
【发布时间】:2023-02-02 14:15:10
【问题描述】:

当用户向下滚动时,我试图获得与 iOS 上的设置应用程序相同的大标题行为。大标题和小标题之间的过渡是平滑的。但在 Xamarin Forms 上,标题会卡住。

在我的 NavigationPage 中,我设置了PrefersLargeTitles="true"。在嵌入的内容页面中,我设置了LargeTitleDisplay="Always"UseSafeArea="true"。页面中的内容如下所示:

<ContentPage.Content>
    <AbsoluteLayout>
        <ListView />
        <Frame x:Name="LoadingFrame" /> <!-- Only visible until ListView is loaded -->
    </AbsoluteLayout>
</ContentPage.Content>

我尝试设置NavigationPage.IsNavigationBarTranslucent="True"。然后它可以工作,但前提是我在 ContentPage 中禁用 SafeArea (Page.UseSafeArea="False")。禁用 SafeArea 不是我想要的,因为现在内容落后于缺口。

【问题讨论】:

    标签: xaml xamarin xamarin.forms xamarin.ios


    【解决方案1】:

    我遇到过同样的问题。

    诀窍是将列表的顶部约束更改为超级视图代替安全区哪一个仅适用于原生.

    extendedLayoutIncludesOpaqueBars = true;
    

    Xamarin.Forms,我尝试了这些解决方案:

    1. 用一个自定义渲染器设置可滚动视图的 LayoutConstraints (不起作用)

    2. 在自定义渲染器中创建一个 UITableViewController,然后将 Xamarin TableView 元素转换为 UITableView,并将其设置为 UITableViewController 的 TableView 属性,然后将 PushViewController 设置为新的 UITableViewController。 (工作)

      你可以在github上提出问题以获得更好的支持:https://github.com/xamarin/Xamarin.Forms/issues

    【讨论】:

      猜你喜欢
      • 2022-01-22
      • 1970-01-01
      • 2021-12-04
      • 1970-01-01
      • 2019-07-07
      • 2021-08-09
      • 1970-01-01
      • 2017-12-25
      • 1970-01-01
      相关资源
      最近更新 更多