我正在使用带有扩展Xamarin的visual studio 2015来制作应用。当我尝试强制转换为ExpandableListView时,出现错误(System.InvalidCastException)。
using Android.App;
using Android.Widget;
using Android.OS;
using Android.Runtime;
using Android.Content;
using Android.Views;
using System.Collections.Generic;
using Android.Graphics;
using static Android.Widget.ListView;
using static Android.Widget.ExpandableListView;
namespace SecondApp
{
[Activity(Label = "SecondApp", MainLauncher = true, Icon = "@drawable/icon", Theme = "@android:style/Theme.Holo.Light")]
public class MainActivity : Activity
{
ExpandableListView expandableListView;
ListView listView;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
expandableListView = FindViewById<ExpandableListView>(Resource.Id.SavedAnimationsList);
listView = FindViewById<ListView>(Resource.Id.animation);
}
}
我希望你们能帮忙!
感谢。