Android implements the multi select and select all functions of listview control

This article describes how Android implements the multi select and select all functions of listview control. Share with you for your reference, as follows:

Main program code

MainActivity.Java

Myadapter inherited from baseadapter

Layout file of main interface

Layout file used in myadapter

Let's analyze why we use map to save check@R_ 105_ 2419 @ and textview status.

This is related to the refresh mechanism of listview. When you have many listview objects, the listview will refresh every time you drag the listview to scroll up and down. How to refresh? For example, a screen can only display seven listviews at most. If you have ten pieces of data, when you want to see article 8, the first piece of data will naturally be hidden, and the eighth piece of data will be displayed. At this time, the listview will refresh. If you don't save your selected check@R_ 105_ 2419 @ status. At this time, if you choose the first one check@R_ 105_ The status of 2419 @ is true. When you display the remaining data of the eighth, ninth and tenth items, the status of the tenth item is true check@R_ 105_ The status of 2419 @ will be displayed as true, but its status has not been saved. You just see that it is selected. In fact, you still select the first data. That's a fucking question. There's a more bizarre state that you let check@R_ 105_ The status of 2419 @ is true, and the data must be greater than ten. You keep dragging the screen up and down, and you will see it check@R_ 105_ The display status of 2419 @ will jump randomly, but you actually choose the first data, which will just make your users feel very uncomfortable.

More readers interested in Android related content can view the special topics of this site: introduction and advanced tutorial of Android development, summary of Android layout skills, summary of Android view skills, summary of activity operation skills of Android programming, summary of Android operation JSON format data skills, summary of Android resource operation skills, and Android control usage summary

I hope this article will help you in Android programming.

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