Android ListView 打开子集
我想设计一个这样的项目,单击时会打开其他项目的子集,我只在我使用过的其他应用程序中看到它,并且找不到有关如何创建它的任何资源。有人知道怎么做吗?
谢谢。
I would like to design an item like this that opens a subset of other items when clicked, I have only seen it in other applications I've used, and I can't find any resources on how to create it. Does anyone know how to?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前尚不清楚您是否想要创建如下所示的嵌套列表视图
,或者是否想要在用户单击某个项目时打开一个全新的列表。
如果你想使用嵌套列表视图看看这个问题: android 嵌套列表视图
如果你想打开一个新活动,然后使用列表视图创建第二个活动并在项目上单击打开它
Its not clear if you want to created Nested listviews that look like this
or if you want to open a completely new list when the user clicks on an item.
If you want to use a nested listview look at this question: android nested listview
And if you want to open a new activity, then create a 2nd activity with a listview and open that on an item click
也许您应该尝试看看
ExpandableListView
。文档可从此处获取:
http://developer.android.com/reference/android/widget/ExpandableListView.html
如果您想添加一个可打开另一个列表的
ListView
,您可以通过多种方式实现。我通过向ListView
添加OnItemClickListener
成功完成此操作,然后只需在ListView
中加载一组新数据并使用invalidate()
或通过设置新的Adapter
。您甚至可以添加一些很酷的过渡或动画,并在动画完成时创建一个侦听器。很多很酷的想法:-)
Perhaps you should try to have a look at the
ExpandableListView
.Documentation is available from here:
http://developer.android.com/reference/android/widget/ExpandableListView.html
If you wanted to add a
ListView
that opens another list, you can do it in several ways. I've successfully done it by adding anOnItemClickListener
to theListView
and then simply load a new set of data in theListView
and update it usinginvalidate()
or by setting a newAdapter
.You could even add some cool transitions or animations, and create a listener for when the animation is completed. Lots of cool ideas :-)