0

I have a listview in which each view contains the summary of a topic, along with a few other pieces of data. When the user clicks one of the items, I want to inflate a new view that contains the summary as well as the full text of the question, plus a few new pieces of data. I would like this to display inside the current listview, not launch a new activity. How could I go about doing this?

Edit: I'm thinking that one way to do this would be, rather than creating/inflating a new view, to put all of the elements in the initial view but set some of them to invisible initially. Then I can program the OnClickListener to set those items visible. My question, then, is how to get access to the items in each view?

4

2 回答 2

1

感谢您建议可扩展的列表视图 - 这是一个好主意,我将来可能会使用它。但是,对于这种情况,我认为将所有元素加载到单个视图中并将其中一些元素设置为不可见的解决方案效果最好。我没有将 OnItemClickedListener 添加到 ListView,而是在适配器的 getView 方法中将 OnClickListeners 添加到视图本身。现在似乎工作得很好,但是我愿意接受关于这样做的想法/其他建议。

于 2013-02-04T04:55:38.970 回答
1

根据我理解您的问题,我想建议您应该使用可扩展的列表视图。并将您的描述或额外信息作为每个组的子项。

您将找到可扩展列表视图的示例。这里

于 2013-02-04T04:34:41.863 回答