-2

I am using custom dialog and I want to remove this blue line. How can I do this?

I tried alert.requestWindowFeature(Window.FEATURE_NO_TITLE); and some other method but no effects

below code is not working!

int divierId = alert.getContext().getResources()
                .getIdentifier("android:id/titleDivider", null, null);
View divider = alert.findViewById(divierId);
divider.setBackgroundColor(getResources().getColor(R.color.creamcolor));

this image

Android
  • 8,995
  • 9
  • 67
  • 108
  • 1
    Possible duplicate of [how to hide the blue line title divder alertdialog?](http://stackoverflow.com/questions/20853970/how-to-hide-the-blue-line-title-divder-alertdialog) – Strider Feb 15 '16 at 13:24

3 Answers3

0

that blue line in alert dialog is divider between title and message this will change divider color you can set Color.Transperent to hide it

    int divierId = alert.getContext().getResources()
                    .getIdentifier("android:id/titleDivider", null, null);
    View divider = alert.findViewById(divierId);
    divider.setBackgroundColor(getResources().getColor(R.color.creamcolor));
AMD
  • 1,662
  • 18
  • 39
0

I got the Solution to get reference to titledivider of alertdialog to change its color using below code.Hope this helps somebody.

int divierId = dialog.getContext().getResources()
                .getIdentifier("android:id/titleDivider", null, null);
View divider = dialog.findViewById(divierId);
divider.setBackgroundColor(getResources().getColor(R.color.white));
Rahul
  • 510
  • 3
  • 8
0

In order to hide the default blue line:

    Dialog dialog = getDialog();
    if (dialog != null) {
        final int dividerId = dialog.getContext().getResources()
                .getIdentifier("android:id/titleDivider", null, null);
        View divider = dialog.findViewById(dividerId);
        if  (divider != null) {
            divider.setBackground(null);
        }
    }
lomza
  • 9,412
  • 15
  • 70
  • 85