我足够新来使用Xamarin,在我的Xamarin Forms项目中创建了一个Master-Detail页面,并在ListView中表示了我想要放置Title和Icon的菜单,对于图标图像,我必须在所有设备项目中插入每个图标?而且我还有一个小问题,当我单击菜单项并导航到选定的“详细信息”页面时,汉堡菜单消失了MainPageMaster.xaml<?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="XXX" Title="Master"> <StackLayout> <ListView x:Name="MenuItemsListView" SeparatorVisibility="None" HasUnevenRows="true" ItemsSource="{Binding MenuItems}"> <ListView.Header> <Grid BackgroundColor="#03A9F4"> <Grid.ColumnDefinitions> <ColumnDefinition Width="6"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="6"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="15"/> <RowDefinition Height="30"/> <RowDefinition Height="Auto"/> <RowDefinition Height="10"/> </Grid.RowDefinitions> <Label Grid.Column="1" Grid.Row="1" Text="B1 Term" HorizontalTextAlignment="Center" Style="{DynamicResource SubtitleStyle}"/> </Grid> </ListView.Header> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout VerticalOptions="FillAndExpand" Orientation="Horizontal" Padding="20,10,0,10" Spacing="20"> <Image Source="{Binding Icon}" WidthRequest="40" HeightRequest="40" VerticalOptions="Center" /> <Label Text="{Binding Title}" </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout></ContentPage>屏幕在此图像中,我的图标不可见,但我在Android项目中添加了图像
3 回答
慕哥9229398
TA贡献1877条经验 获得超6个赞
要在Android和iOS应用程序中显示Humberger菜单图标,可以使用Title = "☰"特殊字符。这将正确显示菜单图标。
<MasterDetailPage.Master>
<ContentPage Title = "☰" BackgroundColor="Red">
<StackLayout BackgroundColor = "#B2EC5D" >
< ListView x:Name="navigationDrawerList">
</ListView>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
- 3 回答
- 0 关注
- 909 浏览
添加回答
举报
0/150
提交
取消