Reputation: 2409
I'm trying to create a navigation drawer
using Syncfusion SfNavigationDrawer
, 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");
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;
Image image = new Image();
image.Source = ImageSource.FromFile("user.png");
headerLayout.Children.Add(image);
Label header = new Label();
headerLayout.Children.Add(header);
nav.DrawerHeaderView = headerLayout;
Button imageButton = new Button();
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.Text = "Lorem...";
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'm using Xamarin.Forms 2.3.0.49
, and Syncfusion ES 14.2.0.26
. And I should note updating Xamarin
and Android build-tools
didn't help.
Upvotes: 0
Views: 1111
Reputation: 26
I had the same problem. Here is the answer from the Syncfusion support team: The reported crash "No method with name setClipOutline" has been fixed in our latest Essential Studio Volume 2 Service Pack 2, 2016 (Version 14.2.0.32) and is available for download under the following link.
Problem solved.
Upvotes: 1
Reputation: 13546
It is a known bug in the lib. See the latest post in their forum here. Try to use alternate solutions from this thread and this.
In summarization from links:
https://www.syntaxismyui.com/xamarin-forms-masterdetail-page-navigation-recipe/
https://varunrathore.wordpress.com/2015/03/10/xamarin-forms-navigation-drawer/
http://xforms-kickstarter.com/#a-slide-out-menu-using-a-master-detail-page
http://blog.falafel.com/xamarin-creating-a-sliding-tray/
Hope it helps!
Upvotes: 1