Android implements QQ list type classification and suspension prompt

design sketch:

The realization of this effect is realized by using a user-defined expandablelistview, setting an indication layout for it, and monitoring whether the current display classification should be suspended during the sliding process. Today, I took the time to sort out the code and record the use process, so that I can quickly solve similar needs.

Without much to say, let's look directly at the code and usage.

I. project structure

The above three classes are our custom expandablelistview, the main interface, and the adapter used by expandablelistview. The following XML files are the main interface layout, indicator layout, expandablelistview sub item layout and expandablelistview group layout.

II. Implementation code

1. Declare custom expandablelistview in XML

2. Declare that the data source is related (for demonstration, the data is all string type, which can be changed according to the specific requirements)

3. Initialize presentation data

4. Initialize the adapter and use

When initializing the adapter, we can see that we have passed in the context object, type, data and our customexpandlistview object in the construction method, so we need to add the corresponding construction method in the customexpandlistview.

5. Set the floating prompt layout

6. Others

Expand all by default

Item click event

III. summary

As can be seen from the above steps, it is very easy to use customexpandlistview to realize the effect in the figure. The above is all the content of this article. I hope it will bring some help to everyone's study or work. If you have any questions, you can leave a message.

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
分享
二维码
< <上一篇
下一篇>>