Styling titleDivider in Dialog

后端 未结 15 913
面向向阳花
面向向阳花 2020-12-06 05:27

I am wondering how it is possible to get rid of (or change color) titleDivider in Dialog. It is a blue line below dialog title shown on honeycomb+ devices.

相关标签:
15条回答
  • 2020-12-06 05:49

    Thanku All but 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.creamcolor));
    
    0 讨论(0)
  • 2020-12-06 05:49

    In colors.xml:

    <color name="transparent">#00000000</color>
    

    In dialog:

    int divierId = dialog.getContext().getResources().getIdentifier("android:id/titleDivider",null, null);

    View divider = d.findViewById(divierId); divider.setBackgroundColor(getResources().getColor(R.color.transparent));

    0 讨论(0)
  • 2020-12-06 05:51

    Your idea was correct. However, dialogTitleDecorLayout you were looking for is a private resource, so you can't access it in a normal way. But you still can access it using * syntax:

    <item name="*android:dialogTitleDecorLayout">@layout/dialog_title</item>
    

    Adding this to my own style and simply copying dialog_title.xml to my app and changing it slightly solved the problem in my case.

    0 讨论(0)
提交回复
热议问题