I want to show multiple lines with different text styles for each item in a list using AlertDialog, but can't fine any example.
Does anyone know how to customize the items of an AlertDialog? Or do I really have to create an Activity with a ListView for this?
The way to make a checkbox list is to use setMultiChoiceItems . // setup the alert builder AlertDialog. Builder builder = new AlertDialog. Builder(context); builder.
Navigate to the app > res > layout and create a new layout file. Add a ListView as shown below. This layout would be displayed inside the AlertDialog.
Alert Dialog code has three methods:setTitle() method for displaying the Alert Dialog box Title. setMessage() method for displaying the message. setIcon() method is used to set the icon on the Alert dialog box.
Use setAdapter()
on AlertDialog.Builder
to supply your own custom ListAdapter
for your list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With