XamarinでExpandableListViewを使用しているのですが、アダプターセットの仕方が分からず困っています。
SimpleExpandableListAdapter
の部分で
SimpleExpandableListAdapterには引数7を指定するコンストラクタは含まれていません
と表示されます。
c#
1SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter( 2 this, 3 groupList, 4 Android.Resource.Layout.SimpleExpandableListItem1, 5 new string[] { "GROUPE_LIST" }, 6 childList, 7 Android.Resource.Layout.SimpleExpandableListItem2, 8 new string[] { "CHILD_TITLE" } 9 ); 10mlist.Adapter(adapter);
以下がリストのコードです。
c#
1 //親リストgroupList子リストchildList 2 List<Dictionary<string, string>> groupList = new List<Dictionary<string, string>>(); 3 List<List<Dictionary<string, object>>> childList = new List<List<Dictionary<string, object>>>(); 4 5 //デフォルトのグループ"全て" 6 Dictionary<string, string> groupElement = new Dictionary<string, string>(); 7 groupElement.Add("GROUP_TITLE", "全て"); 8 groupList.Add(groupElement); 9 10 11 12 13 14 //子リスト用の文字列(ファイル名)を配列に用意 15 n = 0; 16 foreach (var file in files) 17 { 18 var fn = file.Name; 19 fn = fn.Remove(fn.Length - 4);//拡張子を表示しないように末尾を削除 20 filename[n] = fn;//配列にファイル名を格納 21 n++; 22 } 23 24 25 List<Dictionary<string, object>> childElements = new List<Dictionary<string, object>>(); 26 for (int j = 0; j <= n; j++) 27 { 28 Dictionary<string, object> child = new Dictionary<string, object>(); 29 child.Add("CHILD_TITLE", filename[j]); 30 childElements.Add(child); 31 } 32 childList.Add(childElements);
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/22 00:50 編集
2018/08/22 01:36
2018/08/22 02:25