Xamarin.ios 如何在xamarin.Forms(iOS)的MasterDetailPage中添加亨伯格图标
我是Xamarin的新手。我正在为iOS和Android创建NavigationPage。一切都安排得很好。请参见下面的屏幕截图 在安卓系统中,这是一种方式 但在iOS中,它不能很好地显示 代码: 母版页.xamlXamarin.ios 如何在xamarin.Forms(iOS)的MasterDetailPage中添加亨伯格图标,xamarin.ios,navigation,xamarin.forms,navigation-drawer,Xamarin.ios,Navigation,Xamarin.forms,Navigation Drawer,我是Xamarin的新手。我正在为iOS和Android创建NavigationPage。一切都安排得很好。请参见下面的屏幕截图 在安卓系统中,这是一种方式 但在iOS中,它不能很好地显示 代码: 母版页.xaml <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft
<?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="DroidDrawer.MasterPage" Padding="0,0,0,0" Title="Menu" Icon="humburger">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" Orientation="Vertical" Padding="0,20,0,0" BackgroundColor="#004F80">
<ListView x:Name="listView" VerticalOptions="FillAndExpand" SeparatorVisibility="None" BackgroundColor="#0072BA">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Image Source="{Binding IconSource}" HeightRequest="24" WidthRequest="24" VerticalOptions="Center" Grid.Column="0" Margin="12,10,0,10" />
<Label Text="{Binding Title}" Style="{DynamicResource LabelStyle}" VerticalOptions="Center" HeightRequest="24" TextColor="White" Grid.Column="1" Margin="10,13,0,10" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
母版页.xaml.cs
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace DroidDrawer
{
public partial class MasterPage : ContentPage
{
public ListView ListView { get { return listView; } }
public MasterPage()
{
InitializeComponent();
var masterPageItem = new List<MasterPageItem>();
masterPageItem.Add(new MasterPageItem
{
Title = "Home",
IconSource = "nav_home.png",
TargetType = typeof(HomePage)
});
masterPageItem.Add(new MasterPageItem
{
Title = "CSS",
IconSource = "nav_appointment.png",
TargetType = typeof(CssPage)
});
masterPageItem.Add(new MasterPageItem
{
Title = "Javascript",
IconSource = "nav_feedback.png",
TargetType = typeof(JavascriptPage)
});
masterPageItem.Add(new MasterPageItem
{
Title = "Html",
IconSource = "nav_financialinfo.png",
TargetType = typeof(HtmlPage)
});
listView.ItemsSource = masterPageItem;
}
}
}
使用系统;
使用System.Collections.Generic;
使用Xamarin.Forms;
名称空间DroidDrawer
{
公共部分类母版页:ContentPage
{
公共ListView ListView{get{return ListView;}}
公共母版页()
{
初始化组件();
var masterPageItem=新列表();
masterPageItem.Add(新建masterPageItem)
{
Title=“主页”,
IconSource=“nav_home.png”,
TargetType=typeof(主页)
});
masterPageItem.Add(新建masterPageItem)
{
Title=“CSS”,
IconSource=“nav_appointment.png”,
TargetType=typeof(CssPage)
});
masterPageItem.Add(新建masterPageItem)
{
Title=“Javascript”,
IconSource=“nav_feedback.png”,
TargetType=typeof(JavascriptPage)
});
masterPageItem.Add(新建masterPageItem)
{
Title=“Html”,
IconSource=“nav_financialinfo.png”,
TargetType=typeof(HtmlPage)
});
listView.ItemsSource=masterPageItem;
}
}
}
任何帮助都将不胜感激。6小时后,我找到了解决问题的方法,就是图标太大,无法在屏幕上显示太大。设置30*30图像大小后,解决了这个问题