简体   繁体   English

关于ListView嵌套ListView,如何获取外部ListView项的位置

[英]about ListView nested ListView, how to get the outer ListView item position

I want to delete the inner listview 's item, but I don't know the outer listview 's item position, because I want to delete through it. 我想删除内部listview的项目,但是我不知道外部listview的项目位置,因为我想通过它删除。 How do I do this? 我该怎么做呢? 在此处输入图片说明

You can use ExpandableListView instead of nested Listview. 您可以使用ExpandableListView而不是嵌套的Listview。 Using ExpandableListView you will get id. 使用ExpandableListView,您将获得ID。

You should be using ExpandableListView 您应该使用ExpandableListView

Here you will get a example. 在这里,您将获得一个示例。

But if you want to do as you have done now[should avoid this], Save your outer list (item) id in your inner list adapter model. 但是,如果您想像现在那样做[应避免这种情况],请在内部列表适配器模型中保存外部列表(项目)ID。 After that on item click of inner listview (delete) you will get the id of outer list item. 之后,单击内部列表视图的项目(删除),您将获得外部列表项目的ID。

But you should go with ExpandableListView. 但是您应该使用ExpandableListView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM