在我的应用程序中,我使用shell选项卡条进行导航。一开始,它运行得很好,但当我的应用程序增长时,它开始缓慢工作。
有机会解决这个问题吗?
这是我的外壳:
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Anime.Views"
x:Class="Anime.Views.ShellView"
Shell.NavBarIsVisible="False"
StyleClass="shellStyle">
<TabBar >
<Tab Icon="ic_home.png">
<ShellContent ContentTemplate="{DataTemplate views:HomeView}"/>
</Tab>
<Tab Icon="ic_search.png">
<ShellContent ContentTemplate="{DataTemplate views:SearchView}"/>
</Tab>
<Tab Icon="ic_person.png">
<ShellContent ContentTemplate="{DataTemplate views:ProfileView}"/>
</Tab>
</TabBar>
</Shell>发布于 2020-12-07 20:10:37
您使用的是DataTemplate,这意味着它只在需要时(当您导航到它时)才会加载您的页面,如果您希望它加载得更快(在应用程序启动时它将加载得更快)--这样,当您导航到它时,您的页面将已经加载并准备显示,然后将其设置为直接内容,但是它对您的应用程序启动时间有一个代价,这将增加。
变化
<ShellContent ContentTemplate="{DataTemplate views:HomeView}"/>转到
<ShellContent>
<views:HomeView/>
</ShellContent>https://stackoverflow.com/questions/65187444
复制相似问题