是否可以在不使用自定义渲染器的情况下使用 Xamarin Forms 为 Android 和 iOS 创建底部导航栏。
我听说最新的 Xamarin Forms 支持底部导航栏功能,但遗憾的是我找不到合适的文档。
需要一些帮助/指南来实现相同的。
我正在分享我的应用程序代码,希望对您有所帮助。
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>
客户服务页面:
[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];
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句