I'm completely new to mobile developing, so please bear with me.
I'm trying to create a tree structure, and a solution I came across used an expandablelistview. It isn't very sable and after the first expansion, further children will not expand the size of the parent's cell that they are contained within. This means that I only ever see the first item of the third generation. Any ideas?
Here is the adapter code I'm sure I'm doing wrong:
`Activity m_context = null; List m_VideoList = new List(); Int32 m_margin = 10;
VideoTreeItem_Common m_RootItem = new VideoTreeItem_Common ();
public VideoListAdapter(Activity p_Context, List<VideoTreeItem_Common> p_VideoList) : base(){
m_context = p_Context;
m_VideoList = p_VideoList;
}
public VideoListAdapter(Activity p_Context, VideoTreeItem_Common p_RootItem, Int32 p_MarginIncrease) : base(){
m_VideoList.Add (p_RootItem);
m_RootItem = p_RootItem;
m_context = p_Context;
m_margin += p_MarginIncrease;
}
public override View GetGroupView (int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
{
View header = convertView;
if (header == null) {
header = m_context.LayoutInflater.Inflate (Resource.Layout.VideoListItem, null);
}
SetImageByType (header, m_RootItem);
TextView v_TxtName = header.FindViewById<TextView> (Resource.Id.txtName);
v_TxtName.Text = m_RootItem.Name;
return header;
}
public override View GetChildView (int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
{
VideoTreeItem_Common v_GroupParent = m_VideoList [groupPosition];
if (v_GroupParent.Children.Count > 0) {
//if(m_RootItem.Children.Count > 0){
VideoTreeItem_Common v_GroupChild = v_GroupParent.Children[childPosition];
//VideoTreeItem_Common v_GroupChild = m_RootItem.Children[childPosition];
if (v_GroupChild.Children.Count > 0) {
ExpandableListView v_ChildView = new ExpandableListView (m_context);
v_ChildView.SetAdapter (new VideoListAdapter (m_context, v_GroupChild, 10));
//v_ChildView.SetGroupIndicator (null);
return v_ChildView;
}
else {
View v_Child = null;
if (v_Child == null) {
v_Child = m_context.LayoutInflater.Inflate (Resource.Layout.VideoListItem, null);
}
if (v_GroupChild.ItemType != PSType.PS_Folder) {
SetImageByType (v_Child, v_GroupChild);
TextView v_Text = v_Child.FindViewById<TextView> (Resource.Id.txtName);
if (v_Text != null) {
v_Text.Text = v_GroupChild.Name;
}
}
else {
v_Child = convertView;
}
return v_Child;
}
}
return null;
}
`