汉堡图标和搜索栏之间的空白来自哪里?
Where is whitespace between burger icon and search bar coming from?
如何让 SearchBar 立即出现在汉堡包图标的右侧(请看图片),白色 space 是从哪里来的?我找不到它。
我将 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>
尝试将以下行添加到您的 Toolbar.xml
:
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
如何让 SearchBar 立即出现在汉堡包图标的右侧(请看图片),白色 space 是从哪里来的?我找不到它。
我将 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>
尝试将以下行添加到您的 Toolbar.xml
:
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"