Android uses expandablelistview control to realize the effect of novel directory

Today, I'll tell you about the directory implementation method of Android. Just like the novel directory you see, Android provides expandablelistview control to realize the secondary list display effect. Now I'll tell you about the usage of this control. The following is the XML definition:

When expandablelistview displays data, the list items under each module are closed by default. If you want to expand them during initialization, you can use the expandablelistview. Expandgroup (location) method, and a system built-in icon will appear on the left of each parent list item, which is used to represent the expanded and closed status of the list, If you don't display or want to replace this icon, you can use the expandablelistview. Setgroupindicator (drawable icon) method. I don't use any icon directly here. You can also define your own icon in XML in the adapter. The filling data of expandablelistview needs to be in the mode of secondary menu, so the data structure can be determined according to the project situation, Because the title here is fixed, I only transfer the data under each title. The following is the code of the journalcataloglistadapter:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>