0

This is a questionnaire like app, with groups, each group contains several questions, each question contains several operations/answers.

For example:

---------------------------------------------------
Group 1
---------------------------------------------------
Question       |   Y/N/NA   | Action   | Completed Y/N
---------------------------------------------------
Question    1A |   Dropdown | EditText | Checkbox
Description 1A |
---------------------------------------------------
Question    1B |   Dropdown | EditText | Checkbox
Description 1B |
---------------------------------------------------
Question    1C |   Dropdown | EditText | Checkbox
Description 1C |


---------------------------------------------------
Group 2
---------------------------------------------------
Question       |   Y/N/NA   | Action   | Completed Y/N
---------------------------------------------------
Question    2A |   Dropdown | EditText | Checkbox
Description 2A |
---------------------------------------------------
Question    2B |   Dropdown | EditText | Checkbox
Description 2B |
---------------------------------------------------
Question    2C |   Dropdown | EditText | Checkbox
Description 2C |

............. .............

---------------------------------------------------
Group N
---------------------------------------------------
Question       |   Y/N/NA   | Action   | Completed Y/N
---------------------------------------------------
Question    NA |   Dropdown | EditText | Checkbox
Description NA |
---------------------------------------------------
Question    NB |   Dropdown | EditText | Checkbox
Description NB |
---------------------------------------------------
Question    NC |   Dropdown | EditText | Checkbox
Description NC |

Because the groups and questions could be changed anytime so I would like to make the layout dynamic.

I tried to customize BaseAdaptor with Android.Resource.Layout.SimpleListItem1 but it can handle simple layout, and only for 1 table.

How to make a dynamic layout with multiple tables/lists?

4

2 回答 2

1

试试ExpandableListView吧,它可以让你更灵活地定制。每个父母代表一个小组,其孩子代表问题和答案。您可以在这里查找:http: //developer.android.com/reference/android/widget/ExpandableListView.html。希望这可以帮助。

于 2013-08-12T07:44:46.663 回答
1

您的问题可以分为两部分-

  1. 如何创建子列表和
  2. 如何自定义列表中的每个单元格。

要创建带有标题的子列表,您可以尝试这样的事情。它为每个子列表添加节标题。

要自定义每个单元格,您可以按照此stackoverflow 问题中的说明为单元格膨胀视图

希望这可以帮助。

于 2013-08-12T07:49:33.073 回答