在导航栏中放置搜索栏的最佳方法是什么?



在安卓应用的导航栏中放置搜索栏的最佳方法是什么?

在导航栏中放置搜索栏的最佳方法是什么?

TitleView可以帮助您轻松地在导航栏中显示SearchBar

检查代码:

<ContentPage ...>
<NavigationPage.TitleView>
<<SearchBar Text="testing for search bar"/>
</NavigationPage.TitleView>
...
</ContentPage>

更新:

Page.xaml

<local:CustomPage 
...
xmlns:local="clr-namespace:App19F_5"
x:Class="App19F_5.Page6">
...
</local:CustomPage>

Page.xaml.cs

public partial class Page6 : CustomPage
{
...
}

CustomPage.xaml

<ContentPage ... x:Class="App19F_5.CustomPage">
<NavigationPage.TitleView>
<SearchBar />
</NavigationPage.TitleView>
</ContentPage>

相关内容

最新更新