There are many expandableListView libraries on github. You can find out if there is a suitable one, but it can also be achieved simply by using recyclerView. There are three types of trpe in the adapter, title (popular provinces, etc.), sub-title (Shandong Province, etc.), and specific province.
Click on the extended list to directly insert data and then use adapter.notifyItemIntert() to refresh the list
Recommend two libraries https://github.com/zaihuishou... https://github.com/bignerdran... I feel that the single-layer click effect can be processed separately, download the map directly, and expand the double-layer , secondary menu to download map
I have written briefly before. Define a simple tree structure by yourself, which records the child nodes, the number of layers of this node, whether to display the child nodes of this node and whether this node is a leaf node, and judge the itemType based on these (for example, if it is a leaf node, click Yes Download the map (if it is a non-leaf node, it will expand the next level list), but notifyDataSetChanged() will be triggered every time you click, which I feel is not good.
Android creates an arbitrary level tree control to test your data structure and design. Master Hongyang once wrote a similar article, but he used linear table storage
After thinking about it for a while, there are still many pitfalls, so I just sit quietly and wait for the master
Recommended open source recyclerview https://github.com/bignerdran... Define tree structure ├─ItemStructure │ ├─ItemParent │ │ ├─ItemChildrens │ │ │ ├─ItemChildren1 │ │ │ ├─ ItemChildren2 │ │ │ ├─ItemChildren3 │ │ │ ├─............. ItemStructure is the entire structure of the Item, ItemParent is the drop-down part of the Item, and ItemChildrens is the most sub-layer that can be downloaded content. Classify HeaderView, ItemParent, ItemChildrens list by ViewType
There are many expandableListView libraries on github. You can find out if there is a suitable one, but it can also be achieved simply by using recyclerView. There are three types of trpe in the adapter, title (popular provinces, etc.), sub-title (Shandong Province, etc.), and specific province.
Click on the extended list to directly insert data and then use adapter.notifyItemIntert() to refresh the list
Recommend two libraries
https://github.com/zaihuishou...
https://github.com/bignerdran...
I feel that the single-layer click effect can be processed separately, download the map directly, and expand the double-layer , secondary menu to download map
I have written briefly before. Define a simple tree structure by yourself, which records the child nodes, the number of layers of this node, whether to display the child nodes of this node and whether this node is a leaf node, and judge the itemType based on these (for example, if it is a leaf node, click Yes Download the map (if it is a non-leaf node, it will expand the next level list), but notifyDataSetChanged() will be triggered every time you click, which I feel is not good.
Android creates an arbitrary level tree control to test your data structure and design. Master Hongyang once wrote a similar article, but he used linear table storage
After thinking about it for a while, there are still many pitfalls, so I just sit quietly and wait for the master
Recommended open source recyclerview https://github.com/bignerdran...
Define tree structure
├─ItemStructure
│ ├─ItemParent
│ │ ├─ItemChildrens
│ │ │ ├─ItemChildren1
│ │ │ ├─ ItemChildren2
│ │ │ ├─ItemChildren3
│ │ │ ├─.............
ItemStructure is the entire structure of the Item, ItemParent is the drop-down part of the Item, and ItemChildrens is the most sub-layer that can be downloaded content. Classify HeaderView, ItemParent, ItemChildrens list by ViewType