【问题标题】:Xamarin froms Tabbar load page DynamicallyXamarin 动态形成 Tabbar 加载页面
【发布时间】:2018-11-03 13:13:54
【问题描述】:

我们正在使用 xamrin from 构建一个移动应用程序,我们的场景是从侧边菜单导航到标签栏,我们需要动态设置标签栏的当前页面,

这是我们的代码,

 public Task NavigateToMyCartPage()
        {
            switch (Device.RuntimePlatform)
            {
                case Device.iOS:
                    this.CurrentPage = this.Children[2];
                    break;
                case Device.Android:
                    this.CurrentPage = this.Children[2];
                    break;
                default: break;
            }
            return Task.CompletedTask;
        }

在 iOS 中导航正常工作。在android中,我们面临着问题,比如它没有导航到第三页。它导航到第一页。

任何帮助将不胜感激

【问题讨论】:

  • 你能在你打电话给NavigateToMyCartPage()的地方发帖吗?您在哪里称呼它可能会有所不同。
  • 我们有标签栏的公共实例和公共静态 MainTabbarPage mainTabbarPage;一页一页我们调用mainTabbarPage.NavigateToMyCartPage();

标签: android xamarin xamarin.forms navigation tabbar


【解决方案1】:

尝试在 UI 线程上设置当前页面:

    Device.BeginInvokeOnMainThread(() =>
    {
        // your code here
        this.CurrentPage = this.Children[2];
    });

【讨论】:

  • 尼克·科瓦尔斯基,运气不好
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-29
  • 1970-01-01
  • 1970-01-01
  • 2016-09-12
  • 1970-01-01
  • 2016-02-19
相关资源
最近更新 更多