Android uses alertdialog to realize the information list single selection and multi selection dialog functions

When using alertdialog to implement single selection and multi selection dialog boxes, set setsinglechoiceitems() and setmultichoiceitems() functions respectively.

Here are the main codes:

Data source array:

Main codes in activity:

Click event:

Corresponding method:

(1) The showalertdialog () method realizes the radio selection effect, and selectweatherid sets the location of the selected entry

(2) Showmultidialog() method to achieve multi selection effect

The above is the main method of implementation.

The effects are as follows:

Single choice:

Multiple choices:

This site also provides you with special columns about Android development. You can refer to the following:

Android verification code function

Android recyclerview Usage Summary

Android listview common features

Detailed usage of Android control ImageView

Android SDK basic tutorial

Summary of cache knowledge in Android Development

The above is what Xiaobian introduced to you. Android uses alertdialog to realize the information list single selection and multi selection dialog functions. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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