【问题标题】:Xamarin.Forms Bottom Menu for Android适用于 Android 的 Xamarin.Forms 底部菜单
【发布时间】:2017-12-03 15:42:54
【问题描述】:

我设法在 Android 的底部显示菜单栏。我完全按照本指南进行操作:https://asyncawait.wordpress.com/2016/06/16/bottom-menu-for-xamarin-forms-android/#more-24

我的问题是我正在开发 RTL(从右到左)语言应用程序,因此我想将最后一个选项卡显示为加载时的默认激活选项卡。 所以我在 PopulateChildren 方法中更改了以下内容:

        LoadPageContent(0);

收件人:

        LoadPageContent(3); //I have total 4 pages (0,1,2,3)

现在默认加载最后一页,但选项卡的选定颜色仍在第一个选项卡上。
(来源:cubeupload.com

我想在最后一页显示选定的标签颜色。我该怎么做??

【问题讨论】:

  • 使用BottomBar.SetDefaultTabPosition(int defaultTabPosition) 设置默认位置。问题不清楚,请给出更详细的代码。
  • 它没有用。我发布了一个有效的答案。感谢您的努力:)

标签: xamarin.forms xamarin.android


【解决方案1】:

在 TabbedPage 构造函数中设置 CurrentPage={Your Last Page Here}

【讨论】:

  • 它不工作。什么都没发生。我尝试了渲染器的构造函数 MainPageRenderer
【解决方案2】:

在渲染器的 PopulateChildren 方法中添加这两行

LoadPageContent(3); //This will load the 4th page
_bottomBar.SelectTabAtPosition(3, false); //This will move the bottomBar selected tab position to the 4th tab

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    • 2019-05-06
    相关资源
    最近更新 更多