xaml - 汉堡图标和搜索栏之间的空白来自哪里?
问题描述
如何让 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>
解决方案
尝试将以下行添加到您的Toolbar.xml
:
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
推荐阅读
- javascript - ES6 箭头函数奇怪的行为
- angular - 添加带有角度和自动完成材料的新输入时的重复性
- c++ - EnumChildWindows 中的 MoveWindow 对对话框内的列表视图的影响:为什么 ListView 标题不能正确滚动
- android - 为什么我们使用 dp?
- typescript - 如何在 TypeScript 中获取属性名和类名
- java - 反射找不到构造函数
- javascript - 在 jqGrid 上使用子网格与父行中的数据
- python - 每次修改时我都需要更新我的字典
- kotlin - 有没有办法在 Kotlin 中获取继承接口(或另一个类)的对象类型?
- mongodb - 为什么布尔在mongodb中为以下代码返回true?