嗨,伙计们,我正在做一个 Xamarin.Forms 应用程序,您现在可以看到这是我的应用程序:
在此屏幕截图中,您可以看到我的 App.xaml.cs,我在其中上传了 StartPage(),它是一个 BottomBarPage。
public App()
{
InitializeComponent();
//MainPage = new Login();
NavigationPage nav = new NavigationPage(new StartPage());
Image img = new Image();
img.Source = "about_us.png";
Label label = new Label();
label.Text = "My App";
label.VerticalTextAlignment = TextAlignment.Center;
label.TextColor = Color.Black;
StackLayout stack = new StackLayout();
stack.Children.Add(img);
stack.Children.Add(label);
nav.SetValue(NavigationPage.TitleViewProperty, stack);
//nav.SetValue(NavigationPage.TitleProperty, stack);
nav.SetValue(NavigationPage.BarBackgroundColorProperty, Color.FromHex("#D60000"));
MainPage = nav;
}
正如您在我的第一个屏幕中看到的那样,在 App() 中,我试图向导航栏添加标题和应用程序图标,但不起作用,我应该怎么做才能添加它?