How to change textcolor in AlertDialog

前端 未结 5 2009
抹茶落季
抹茶落季 2020-11-27 04:02

\"AlertDialog\"

How to change the textcolor in an AlertDialog?



        
5条回答
  •  隐瞒了意图╮
    2020-11-27 04:43

    After you create your dialog:

    AlertDialog dialog = builder.create();
    dialog.show();
    Button buttonPositive = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
    buttonPositive.setTextColor(ContextCompat.getColor(this, R.color.green));
    Button buttonNegative = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
    buttonNegative.setTextColor(ContextCompat.getColor(this, R.color.red));
    

提交回复
热议问题