I'm trying to create a navigation drawer from samples, but I get the following exception on android simulator.
>Java.Lang.NoSuchMethodError: no method with name='setClipToOutline' signature='(Z)V' in class Lcom/xamarin/forms/platform/android/FormsViewGroup;
This is my code:
public class MainPage : ContentPage
{
public MainPage()
{
SfNavigationDrawer nav = new SfNavigationDrawer
{
};
StackLayout mainStack = new StackLayout();
mainStack.Opacity = 1;
mainStack.Orientation = StackOrientation.Vertical;
mainStack.HeightRequest = 500;
mainStack.BackgroundColor = Color.White;
ObservableCollection<String> list = new ObservableCollection<string>();
list.Add("Home");
list.Add("Profile");
list.Add("Inbox");
list.Add("Outbox");
list.Add("Sent");
list.Add("Draft");
ListView listView = new ListView();
listView.WidthRequest = 200;
listView.VerticalOptions = LayoutOptions.FillAndExpand;
listView.ItemsSource = list;
mainStack.Children.Add(listView);
nav.DrawerContentView = mainStack;
StackLayout headerLayout = new StackLayout();
headerLayout.Orientation = StackOrientation.Vertical;
headerLayout.BackgroundColor = Color.FromHex("#1aa1d6");
headerLayout.VerticalOptions = LayoutOptions.CenterAndExpand;
headerLayout.HorizontalOptions = LayoutOptions.CenterAndExpand;
headerLayout.HeightRequest = 200;
headerLayout.WidthRequest = 275;
Image image = new Image();
image.Source = ImageSource.FromFile("user.png");
image.HeightRequest = 100;
image.WidthRequest = 70;
image.HorizontalOptions = LayoutOptions.CenterAndExpand;
image.VerticalOptions = LayoutOptions.Center;
image.BackgroundColor = Color.FromHex("#1aa1d6");
headerLayout.Children.Add(image);
Label header = new Label();
header.Text = "James Pollock";
header.FontSize = 20;
header.HeightRequest = 30;
header.WidthRequest = 140;
header.TextColor = Color.White;
header.HorizontalOptions = LayoutOptions.Center;
header.VerticalOptions = LayoutOptions.Center;
header.BackgroundColor = Color.FromHex("#1aa1d6");
headerLayout.Children.Add(header);
nav.DrawerHeaderView = headerLayout;
Button imageButton = new Button();
//imageButton.Source = (FileImageSource)ImageSource.FromFile("_menu_.png");
imageButton.WidthRequest = 50;
Label homeLabel = new Label();
homeLabel.Text = "Home";
homeLabel.FontSize = 15;
homeLabel.TextColor = Color.White;
homeLabel.HorizontalTextAlignment = TextAlignment.Center;
homeLabel.VerticalTextAlignment = TextAlignment.Center;
StackLayout headerFrame = new StackLayout();
headerFrame.Orientation = StackOrientation.Horizontal;
headerFrame.Children.Add(imageButton);
headerFrame.Children.Add(homeLabel);
Label mainLabel = new Label();
mainLabel.FontSize = 14;
mainLabel.TextColor = Color.Black;
mainLabel.Text = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus. Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula. Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
StackLayout ContentFrame = new StackLayout();
ContentFrame.Orientation = StackOrientation.Vertical;
ContentFrame.BackgroundColor = Color.White;
ContentFrame.Children.Add(headerFrame);
ContentFrame.Children.Add(mainLabel);
nav.ContentView = ContentFrame;
nav.Position = Position.Left;
nav.Transition = Transition.SlideOnTop;
this.Content = nav;
}
}
I'll be thankful if you could help me get it working.