Change text color in AlertDialog

2

I'm creating an Android application and would like to know how do I change the red color of the phrase "SPI Equation" in this AlertDialog?

AlertDialog.Builder dlg = new AlertDialog.Builder(this);
    dlg.setMessage("Equação SPI \n\n"+
        "Calculos:\n\n" +
        "L1 vezes "+D1+" menos a L2.\n " +
        "L1 vezes "+D2+" menos a L3\n\n"+
        "Temos:\n\n"+
        valorA1+"X+"+valorB1+"Y+"+valorC1+"Z="+valorK1+"\n"+
        L2A+"X+"+L2B+"Y+"+L2C+"Z="+L2K+"\n"+
        D3A+"X+"+D3B+"Z+"+D3C+"Z="+D3K+"\n\n"+
        "Por fim L2 vezes "+D3+" menos a L3\n\n"+
        "Equações Escalonadas:\n\n"+
        valorA1+"X+"+valorB1+"Y+"+valorC1+"Z="+valorK1+"\n"+
        L2A+"X+"+L2B+"Y+"+L2C+"Z="+L2K+"\n"+
        L3A+"X+"+L3B+"Z+"+L3C+"Z="+L3K+"\n\n");

dlg.setNeutralButton("ok", null);
dlg.show();
    
asked by anonymous 28.11.2015 / 17:21

1 answer

3

Do not use setMessage use setView and do all XML training.

AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setView(R.layout.um_layout_qualquer ou [view inflada dinamicamente]);

dlg.setNeutralButton("ok", null);
dlg.show();
    
28.11.2015 / 18:48