private void PrepareListData() { listDataHeader = new List <ExpandedMenuModel>(); listDataChild = new Dictionary <ExpandedMenuModel, List <String> >(); ExpandedMenuModel item1 = new ExpandedMenuModel(); item1.Name = "heading1"; item1.Image = Resource.Drawable.abc_ic_menu_copy_mtrl_am_alpha; // Adding data header listDataHeader.Add(item1); ExpandedMenuModel item2 = new ExpandedMenuModel(); item2.Name = "heading2"; item2.Image = Resource.Drawable.abc_ic_voice_search_api_material; listDataHeader.Add(item2); ExpandedMenuModel item3 = new ExpandedMenuModel(); item3.Name = "heading3"; item3.Image = Resource.Drawable.abc_ic_menu_share_mtrl_alpha; listDataHeader.Add(item3); ExpandedMenuModel item4 = new ExpandedMenuModel(); item4.Name = "heading4"; item4.Image = Resource.Drawable.abc_ic_menu_paste_mtrl_am_alpha; listDataHeader.Add(item4); // Adding child data List <String> heading1 = new List <String>(); heading1.Add("Submenu of item 1"); List <String> heading2 = new List <String>(); heading2.Add("Submenu of item 2"); heading2.Add("Submenu of item 2"); heading2.Add("Submenu of item 2"); List <String> heading3 = new List <String>(); heading3.Add("Submenu of item 3"); heading3.Add("Submenu of item 3"); List <String> heading4 = new List <String>(); heading4.Add("Submenu of item 4"); heading4.Add("Submenu of item 4"); listDataChild.Add(listDataHeader[0], heading1); // Header, Child data listDataChild.Add(listDataHeader[1], heading2); listDataChild.Add(listDataHeader[2], heading3); listDataChild.Add(listDataHeader[3], heading4); }
public override View GetGroupView(int groupPosition, bool isExpanded, View convertView, ViewGroup parent) { ExpandedMenuModel headerTitle = _listDataHeader[groupPosition]; convertView = convertView ?? _context.LayoutInflater.Inflate(Resource.Layout.list_header, null); TextView lblListHeader = (TextView)convertView.FindViewById(Resource.Id.submenu); ImageView headerIcon = (ImageView)convertView.FindViewById(Resource.Id.iconimage); lblListHeader.Text = headerTitle.Name; headerIcon.SetImageResource(headerTitle.Image); return(convertView); }