Skip to content Skip to sidebar Skip to footer

Alertdialog Does Not Show Dividers On A List

I have this class: public class PageDetailInfoView extends FrameLayout { //few constructors and methods //method to show an AlertDialog with a list private void openDialog(){

Solution 1:

Change AlertDialog List items divider color as:

AlertDialogalertDialogObject= dialogBuilder.create();
ListView listView=alertDialogObject.getListView();  
listView.setDivider(newColorDrawable(Color.BLUE)); // set color
listView.setDividerHeight(2); // set height 
alertDialogObject.show();

Solution 2:

It is probably because you are running your app on Android 5.0+ which has Material design.

To get the "old" look, just construct your dialog with the Holo style:

ContextThemeWrapperthemedContext=newContextThemeWrapper(getContext(), android.R.style.Theme_Holo_Light_Dialog_NoActionBar);
AlertDialog.Builderbuilder=newAlertDialog.Builder(themedContext);
// ... then create your dialog

Although this might seem weird for some users (especially on Lollipop and Marshmallow, so I recommend looking into using custom views for your dialog.

Post a Comment for "Alertdialog Does Not Show Dividers On A List"