【发布时间】:2019-09-06 22:55:00
【问题描述】:
是否可以在不使用自定义渲染器的情况下使用 Xamarin 表单为 Android 和 iOS 创建底部导航栏。
我听说最新的 Xamarin Forms 支持底部导航栏功能,但遗憾的是我找不到合适的文档。
需要一些帮助/指南来实施相同的操作。
【问题讨论】:
-
检查是否有帮助:montemagno.com/…
标签: xamarin.forms xamarin.android
是否可以在不使用自定义渲染器的情况下使用 Xamarin 表单为 Android 和 iOS 创建底部导航栏。
我听说最新的 Xamarin Forms 支持底部导航栏功能,但遗憾的是我找不到合适的文档。
需要一些帮助/指南来实施相同的操作。
【问题讨论】:
标签: xamarin.forms xamarin.android
我正在分享我的应用程序代码,希望对您有所帮助。
XML 页面:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iSAS.Mobile.Views.Student.SettingsPage"
Title="Profile"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
BarBackgroundColor="White"
BarTextColor="#2196F3"
android:TabbedPage.ToolbarPlacement="Bottom"
android:TabbedPage.BarItemColor="#66FFFFFF"
android:TabbedPage.BarSelectedItemColor="#2196F3" >
</TabbedPage>
CS 页面:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : TabbedPage
{
public SettingsPage()
{
InitializeComponent();
Children.Add(new ProfilePage());
Children.Add(new ChangePassword());
Children[0].Icon = "profile.png";
Children[1].Icon = "settings.png";
CurrentPage = Children[1];
}
public SettingsPage(bool DefaultChangePswdPage = true)
{
InitializeComponent();
Children.Add(new ProfilePage());
Children.Add(new ChangePassword());
Children[0].Icon = "profile.png";
Children[1].Icon = "settings.png";
if (DefaultChangePswdPage)
CurrentPage = Children[1];
}
}
【讨论】: