【问题标题】:`Java.Lang.NoSuchMethodError` exception while using Navigation Drawer使用导航抽屉时出现“Java.Lang.NoSuchMethodError”异常
【发布时间】:2016-12-28 18:57:22
【问题描述】:

我正在尝试使用 Syncfusion SfNavigationDrawer 创建一个 navigation drawer,但在 android 模拟器上出现以下异常。

Java.Lang.NoSuchMethodError:Lcom/xamarin/forms/platform/android/FormsViewGroup 类中没有名称='setClipToOutline' 签名='(Z)V' 的方法;

这是我的代码:

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;

    }
}

我正在使用Xamarin.Forms 2.3.0.49Syncfusion ES 14.2.0.26。我应该注意到更新 XamarinAndroid build-tools 没有帮助。

【问题讨论】:

    标签: xamarin xamarin.android xamarin.forms syncfusion


    【解决方案1】:

    我遇到了同样的问题。 以下是 Syncfusion 支持团队的回答: 报告的崩溃“No method with name setClipOutline”已在我们最新的 Essential Studio Volume 2 Service Pack 2, 2016(版本 14.2.0.32)中修复,可通过以下链接下载。

    https://www.syncfusion.com/forums/125638/essential-studio-2016-volume-2-service-pack-release-v14-2-0-32-available-for-download

    问题解决了。

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多