Change dialog text color on 5.0+

前端 未结 1 1778
一个人的身影
一个人的身影 2021-01-05 07:24

I\'m trying to change the text color in dialog boxes, most commonly AlertDialog. I\'ve tried every solution at these pages:

AlertDialog styling - how to change styl

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 08:16

    In your case, I think the dialog theme would work.

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.YourDialogStyle;
    

    You can specify your dialog theme just like the code above.

    
    

    Here is the example of theme for Dialog.

    • android:colorAccent will affect your text colors of negative or positive buttons.
    • android:textColor will affect your title text color of dialog.
    • android:textColorPrimary will affect your message color of dialog.

    Another option is you can make your own custom layout for the dialog.

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