如何解决汉堡图标和搜索栏之间的空白从何而来?
如何让 SearchBar 立即出现在汉堡包图标的右侧(请参见图片),空白从何而来?我找不到。
我将 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"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。