C#开发Android移动应用系列之TabbedPage页面设置
By
jerryxjr1220
at 2023-08-17 • 0人收藏 • 488人看过
之前演示了通过点击按钮实现页面跳转,其实Xamarin支持TabbedPage实现各子页面的调度。
修改MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:view="clr-namespace:XamarinApp1.Views" xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core" android:TabbedPage.ToolbarPlacement="Bottom" x:Class="XamarinApp1.MainPage"> <view:Page1 Title="首页"/> <view:Page2 Title="第二页" /> <view:Page3 Title="第三页" /> </TabbedPage>
2. 修改MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Essentials;
using XamarinApp1.ViewModels;
using XamarinApp1.Models;
namespace XamarinApp1
{
public partial class MainPage : TabbedPage
{
public MainPage()
{
InitializeComponent();
}
}
}
1 个回复 | 最后更新于 2023-08-17
登录后方可回帖
图片过大,上传不了了
可查看:
https://note.youdao.com/s/cPrD2rcM