【发布时间】:2021-02-12 12:45:37
【问题描述】:
如何让 SearchBar 立即出现在汉堡包图标的右侧(请参见图片),白色空间来自哪里?我找不到它。
Iv 将 NavigationPage 中的 stackLayout 和 SearchBar 设置为 `HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand"
它来自 burgerIcon 按钮的填充。怎么查,代码里也找不到?
感谢任何回复
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"x:Class="WineShop.Views.Products">
<NavigationPage.TitleView>
<StackLayout HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand" Orientation="Horizontal">
<SearchBar x:Name="SearchBar" TextChanged="SearchBar_TextChanged" HorizontalOptions="StartAndExpand" Placeholder="Search..." PlaceholderColor="Gray" TextColor="White" VerticalOptions="StartAndExpand"/>
</StackLayout>
</NavigationPage.TitleView>
<ContentPage.ToolbarItems>
<ToolbarItem Name="shoppingCartImg" Icon="shoppingCartImg.png" Priority="0" Order="Primary" Activated="ShoppingCartClicked"/>
<ToolbarItem Text="{Binding NoItemsInShoppingCart}" Priority="0" Order="Primary" Activated="ShoppingCartClicked"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<Grid>
【问题讨论】:
-
汉堡按钮是如何定义的?
-
我不确定,当您使用“主详细信息”模板创建新项目时,它会预加载。所以我不确定它在哪里定义
标签: xaml xamarin xamarin.forms searchbar