回答編集履歴
5
追記
test
CHANGED
@@ -45,3 +45,107 @@
|
|
45
45
|
List<IList<IDictionary<string, object>>> childList = new List<IList<IDictionary<string, object>>>();
|
46
46
|
|
47
47
|
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
#### 追記
|
52
|
+
|
53
|
+
普通の`List`や`Dictionay`では、ダメっぽいですね。
|
54
|
+
|
55
|
+
`JavaList`や`JavaDictionary`を使わないといけないようです。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```C#
|
60
|
+
|
61
|
+
//親リストgroupList子リストchildList
|
62
|
+
|
63
|
+
List<IDictionary<string,object>> groupList = new List<IDictionary<string,object>>();
|
64
|
+
|
65
|
+
List<IList<IDictionary<string, object>>> childList = new List<IList<IDictionary<string, object>>>();
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
//デフォルトのグループ"全て"
|
70
|
+
|
71
|
+
JavaDictionary<string,object> groupElement = new JavaDictionary<string,object>();
|
72
|
+
|
73
|
+
groupElement.Add("GROUP_TITLE", "全て");
|
74
|
+
|
75
|
+
groupList.Add(groupElement);
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
//子リスト用の文字列(ファイル名)を配列に用意
|
88
|
+
|
89
|
+
n = 0;
|
90
|
+
|
91
|
+
foreach (var file in files)
|
92
|
+
|
93
|
+
{
|
94
|
+
|
95
|
+
var fn = file.Name;
|
96
|
+
|
97
|
+
fn = fn.Remove(fn.Length - 4);//拡張子を表示しないように末尾を削除
|
98
|
+
|
99
|
+
filename[n] = fn;//配列にファイル名を格納
|
100
|
+
|
101
|
+
n++;
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
JavaList<IDictionary<string, object>> childElements = new JavaList<IDictionary<string, object>>();
|
110
|
+
|
111
|
+
for (int j = 0; j <= n; j++)
|
112
|
+
|
113
|
+
{
|
114
|
+
|
115
|
+
JavaDictionary<string, object> child = new JavaDictionary<string, object>();
|
116
|
+
|
117
|
+
child.Add("CHILD_TITLE", filename[j]);
|
118
|
+
|
119
|
+
childElements.Add(child);
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
childList.Add(childElements);
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter(
|
128
|
+
|
129
|
+
this,
|
130
|
+
|
131
|
+
groupList,
|
132
|
+
|
133
|
+
Android.Resource.Layout.SimpleExpandableListItem1,
|
134
|
+
|
135
|
+
new string[] { "GROUPE_LIST" },
|
136
|
+
|
137
|
+
new int[] { Android.Resource.Id.Text1 },
|
138
|
+
|
139
|
+
childList,
|
140
|
+
|
141
|
+
Android.Resource.Layout.SimpleExpandableListItem2,
|
142
|
+
|
143
|
+
new string[] { "CHILD_TITLE" },
|
144
|
+
|
145
|
+
new int[] { Android.Resource.Id.Text2 }
|
146
|
+
|
147
|
+
);
|
148
|
+
|
149
|
+
expandableListView.SetAdapter(adapter);
|
150
|
+
|
151
|
+
```
|
4
コード修正
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
new string[] { "GROUPE_LIST" },
|
16
16
|
|
17
|
-
new int[] { Resource.Id.
|
17
|
+
new int[] { Android.Resource.Id.Text1 },
|
18
18
|
|
19
19
|
(IList<IList<IDictionary<string, object>>>)childList,
|
20
20
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
new string[] { "CHILD_TITLE" },
|
24
24
|
|
25
|
-
new int[] { Resource.Id.
|
25
|
+
new int[] { Android.Resource.Id.Text2 }
|
26
26
|
|
27
27
|
);
|
28
28
|
|
3
コード修正
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
this,
|
10
10
|
|
11
|
-
(IL
|
11
|
+
(IList<IDictionary<string, object>>)groupList,
|
12
12
|
|
13
13
|
Android.Resource.Layout.SimpleExpandableListItem1,
|
14
14
|
|
2
コード修正
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
new int[] { Resource.Id.text1 },
|
18
18
|
|
19
|
-
(IL
|
19
|
+
(IList<IList<IDictionary<string, object>>>)childList,
|
20
20
|
|
21
21
|
Android.Resource.Layout.SimpleExpandableListItem2,
|
22
22
|
|
1
コード修正
test
CHANGED
@@ -10,19 +10,17 @@
|
|
10
10
|
|
11
11
|
(ILIst<IDictionary<string, object>>)groupList,
|
12
12
|
|
13
|
+
Android.Resource.Layout.SimpleExpandableListItem1,
|
13
14
|
|
15
|
+
new string[] { "GROUPE_LIST" },
|
14
16
|
|
15
|
-
new int[] { Resource.Id.text1 } Android.Resource.Layout.SimpleExpandableListItem1,
|
16
|
-
|
17
|
-
new
|
17
|
+
new int[] { Resource.Id.text1 },
|
18
|
-
|
19
|
-
|
20
18
|
|
21
19
|
(ILIst<IList<IDictionary<string, object>>>)childList,
|
22
20
|
|
23
21
|
Android.Resource.Layout.SimpleExpandableListItem2,
|
24
22
|
|
25
|
-
new string[] { "CHILD_TITLE" }
|
23
|
+
new string[] { "CHILD_TITLE" },
|
26
24
|
|
27
25
|
new int[] { Resource.Id.text2 }
|
28
26
|
|