我想在 Xamarin Forms 的选项卡式页面顶部添加一个搜索选项卡。这是我要实现的 UI。
如您所见,选项卡供应商名称和产品/服务顶部有一个搜索栏。我不知道如何实现它。我试过这段代码
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:RestaurantApp"
x:Class="RestaurantApp.SearchTabbedPage"
NavigationPage.HasNavigationBar="False">
<ContentPage>
<StackLayout>
<StackLayout Orientation="Horizontal"
HorizontalOptions="FillAndExpand"
Padding="5">
<Label TextColor="#606060" FontSize="Large" Text="EXPLORE"
HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<BoxView Color="#E0E0E0" WidthRequest ="80" HeightRequest="1"/>
<Frame CornerRadius="10" Padding="0" OutlineColor="DarkGray" HasShadow="True" HorizontalOptions="Fill" Margin="10,0,10,0" VerticalOptions="Center">
<pages:searchTab x:Name="searchBar" Placeholder="Search" PlaceholderColor="Black" TextColor="Black" HorizontalOptions="FillAndExpand" VerticalOptions="Center" />
</Frame>
</StackLayout>
</ContentPage>
<TabbedPage.Children>
<NavigationPage Title="VENDOR NAME">
<x:Arguments>
<pages:TabbedPageExampleTab1 />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="PRODUCT/SERVICE">
<x:Arguments>
<pages:TabbedPageExampleTab2 />
</x:Arguments>
</NavigationPage>
</TabbedPage.Children>
</TabbedPage>
但它又创建了一个标签。我不知道如何实现这一点。我没有得到任何解决方案。有什么建议么?
注意:
我有导航标签标题和底部导航栏的代码。我想让它们在两个标签页中保持通用。所以它必须以与搜索选项卡相同的方式实现。