public override void SetAdapter(IExpandableListAdapter adapter)
 {
     base.SetAdapter(adapter);
     if (adapter is AnimatedExpandableListAdapter)
     {
         this.adapter = (AnimatedExpandableListAdapter)adapter;
         this.adapter.setParent(this);
     }
     else
     {
     }
 }
Exemplo n.º 2
0
        /**
         * @see ExpandableListView#setAdapter(ExpandableListAdapter)
         */
        public override void SetAdapter(IExpandableListAdapter adapter)
        {
            base.SetAdapter(adapter);

            // Make sure that the adapter extends AnimatedExpandableListAdapter
            if (adapter is AnimatedExpandableListAdapter)
            {
                this.adapter = (AnimatedExpandableListAdapter)adapter;
                this.adapter.SetParent(this);
            }
            else
            {
                throw new ClassCastException(adapter.ToString() + " must implement AnimatedExpandableListAdapter");
            }
        }
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     using (var groupData = new JavaList <IDictionary <string, object> > ())
         using (var childData = new JavaList <IList <IDictionary <string, object> > > ()) {
             for (int i = 0; i < 20; i++)
             {
                 using (var curGroupMap = new JavaDictionary <string, object>()) {
                     groupData.Add(curGroupMap);
                     curGroupMap.Add(Name, "Group " + i);
                     curGroupMap.Add(IsEven, (i % 2 == 0) ? "This group is even" : "This group is odd");
                     using (var children = new JavaList <IDictionary <string, object> > ()) {
                         for (int j = 0; j < 15; j++)
                         {
                             using (var curChildMap = new JavaDictionary <string, object> ()) {
                                 children.Add(curChildMap);
                                 curChildMap.Add(Name, "Child " + j);
                                 curChildMap.Add(IsEven, (j % 2 == 0) ? "This child is even" : "This child is odd");
                             }
                         }
                         childData.Add(children);
                     }
                 }
             }
             // Set up our adapter
             mAdapter = new SimpleExpandableListAdapter(
                 this,
                 groupData,
                 Android.Resource.Layout.SimpleExpandableListItem1,
                 new string[] { Name, IsEven },
                 new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 },
                 childData,
                 Android.Resource.Layout.SimpleExpandableListItem2,
                 new string[] { Name, IsEven },
                 new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 }
                 );
             SetListAdapter(mAdapter);
         }
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            List <IDictionary <String, object> >          groupData = new List <IDictionary <string, object> >();
            List <IList <IDictionary <String, object> > > childData = new List <IList <IDictionary <string, object> > >();

            for (int i = 0; i < 20; i++)
            {
                Dictionary <String, object> curGroupMap = new Dictionary <string, object>();
                groupData.Add(curGroupMap);
                curGroupMap.Add(NAME, "Group " + i);
                curGroupMap.Add(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd");
                List <IDictionary <String, object> > children = new List <IDictionary <string, object> >();
                for (int j = 0; j < 15; j++)
                {
                    Dictionary <String, object> curChildMap = new Dictionary <string, object>();
                    children.Add(curChildMap);
                    curChildMap.Add(NAME, "Child " + j);
                    curChildMap.Add(IS_EVEN, (j % 2 == 0) ? "This child is even" : "This child is odd");
                }
                childData.Add(children);
            }
            // Set up our adapter
            mAdapter = new SimpleExpandableListAdapter(
                this,
                groupData,
                Android.Resource.Layout.SimpleExpandableListItem1,
                new String[] { NAME, IS_EVEN },
                new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 },
                childData,
                Android.Resource.Layout.SimpleExpandableListItem2,
                new String[] { NAME, IS_EVEN },
                new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 }
                );
            SetListAdapter(mAdapter);
        }
Exemplo n.º 5
0
 public static void SetContent(this IQView <ExpandableListView> view, IExpandableListAdapter adapter)
 {
     view.PlatformView.SetContent(adapter);
 }
Exemplo n.º 6
0
 public static void SetContent(this ExpandableListView view, IExpandableListAdapter adapter)
 {
     view.SetAdapter(adapter);
 }