代碼忍者們,大家好!!!
使用 Xamarin 表單中的“<TabbedPage/ >”,我可以輕松地在頁面頂部創建標簽欄。但是,我想要兩個標簽欄而不是一個。例如,第一個選項卡欄行中的 3 個選項卡按鈕和第二行中的另外 3 個選項卡按鈕,并且用戶能夠在所有 6 個頁面之間導航。
有沒有人知道這是否可以在 Xamarin 形式中實作和/或是否有任何可能有幫助的檔案。
uj5u.com熱心網友回復:
除了您的 TabbedPage ??,您還可以使用Xamarin 社區工具包中的 TabView。這是它的作業原理:
<Grid>
<xct:TabView>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent1" />
</Grid>
</xct:TabViewItem>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent2" />
</Grid>
</xct:TabViewItem>
</xct:TabView>
</Grid>
如果您在每個 TabBar 內容中放置一個 TabView,您將能夠獲得您想要的結果。在你的情況下,它會是這樣的:
<ContentPage Title="Tab 1">
<xct:TabView>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent1" />
</Grid>
</xct:TabViewItem>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent2" />
</Grid>
</xct:TabViewItem>
</xct:TabView>
</ContentPage>
<ContentPage Title="Tab 2">
<xct:TabView>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent1" />
</Grid>
</xct:TabViewItem>
<xct:TabViewItem>
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent2" />
</Grid>
</xct:TabViewItem>
</xct:TabView>
</ContentPage>
如果您想了解更多關于 TabViews 的資訊,Gerald Versluis 發表了一篇很棒的文章,它完美地解釋了它:https ://devblogs.microsoft.com/xamarin/xamarin-community-toolkit-tabview/
uj5u.com熱心網友回復:
試試James Montemagno youtube 頻道
編輯
這是該視頻使用的庫的官方 github 鏈接 https://github.com/roubachof/Sharpnado.Tabs
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/382413.html
