MateenSheikh
MateenSheikh

Reputation: 152

How to show scroll bar always in alertdialog in android?

I have alertdialog builder which shows multiChoiceItems, there are many items so all options are not visible and scrollable list is created but scroll bar hides after some seconds. How can I make it visible all the time?

I'm not using custom builder. I know this method but how can I use it setScrollbarFadingEnabled(false)?

Upvotes: 2

Views: 1110

Answers (1)

Blake
Blake

Reputation: 43

You can't do this to a AlertDialog builder. However it is possible to do it to AlertDialog.

Get the AlertDialog from your builder.

AlertDialog dialog = builder.create();

Then you have to show your dialog before you manipulate it.

dialog.show();

Now the methods are available and won't throw errors. Note: You can style your positive and negative buttons here too.

dialog.getListView().setScrollbarFadingEnabled(false);

Upvotes: 3

Related Questions