Usage of embedded checkbox in Android MVP mode listview

MVP mode embedded in listview check@R_989_2419 @Use of

This article is about how to embed a small demo in listview check@R_989_2419 @In combination, this article is similar to the embedded button in the front. It also uses MVP mode to write code. There will be several small details in this case, which I will introduce in the case.

The basic framework of the procedure is as follows:

View layer:

MainActivity. java

ViewInter. java

Presenter layer:

Presenter. java

Model layer:

ModelInter. java

ModelImp. java

Adapter. java

MyBean. java

The basic code has been implemented. Let's see if myadapter is missing Operation effect diagram generated by the annotated code in getview method in Java:

From the operation effect, we can see that the check boxes are not selected at the beginning. When we select the first check box, when we drag down, you will see that check box 7 is obviously selected. When we select check box 2 here, check box 8 is also selected, So what's the reason? This is caused by a reuse control mechanism in listview. The principle has been explained in the previous foundation of this blog, and will not be explained in detail in this case.

Finally, let's take a look at the running result diagram of the uncommented Code:

It can be seen from the operation results that since 1, 2 and 5 are selected by default, when we cancel the selection of 0 for 1 and 2, the reuse components below will not be reused like the operation results above. This is a normal selection. Select if you want to select and cancel if you want to cancel.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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