Why do custom crouton Styles look gray and not their color?

I wanted to customize the styles for my cruton apps. Set 4 colors for any number of styles. This is my style class.

public class TapabookCroutonStyle {
public static final int DURATION_INFINITE = -1;
public static final Style ALERT;
public static final Style WARN;
public static final Style CONFIRM;
public static final Style INFO;

public static final int AlertRed = R.color.rojo_vivo;
public static final int WarnOrange= R.color.naranja_resplandeciente;
public static final int ConfirmGreen = R.color.verde_lima;
public static final int InfoYellow = R.color.amarillo_canario;

private static final int DURATION_SHORT  = 3000;
private static final int DURATION_MEDIUM = 5000;
private static final int DURATION_LONG   = 10000;


static {
    ALERT   = new Style.Builder()
                .setDuration(DURATION_LONG)
                .setBackgroundColorValue(AlertRed)
                .setHeight(LayoutParams.WRAP_CONTENT)
                .build();
    WARN    = new Style.Builder()
                .setDuration(DURATION_MEDIUM)
                .setBackgroundColorValue(ConfirmGreen)
                .setHeight(LayoutParams.WRAP_CONTENT)
                .build();
    CONFIRM = new Style.Builder()
                .setDuration(DURATION_MEDIUM)
                .setBackgroundColorValue(ConfirmGreen)
                .setHeight(LayoutParams.WRAP_CONTENT)
                .build();
    INFO    = new Style.Builder()
                .setDuration(DURATION_MEDIUM)
                .setBackgroundColorValue(InfoYellow)
                .setHeight(LayoutParams.WRAP_CONTENT)
                .build();
}
}

Colors are set in the color.xml file

<color name="verde_lima">#aaee22</color>
<color name="rojo_vivo">#E8110F</color>
<color name="naranja_resplandeciente">#FF6600</color>
<color name="amarillo_canario">#FFCC00</color>

I use wrappers to call Croutons.

/**             Crouton Wrappers                 **/
public void croutonAlert(int stringId){
    Crouton.makeText(this, stringId, TapabookCroutonStyle.ALERT).show();
}
public void croutonAlert(String text){
    Crouton.makeText(this, text, TapabookCroutonStyle.ALERT).show();
}

public void croutonInfo(int stringId){
    Crouton.makeText(this, stringId, TapabookCroutonStyle.INFO).show();
}
public void croutonInfo(String text){
    Crouton.makeText(this, text, TapabookCroutonStyle.INFO).show();
}

public void croutonConfirm(int stringId){
    Crouton.makeText(this, stringId, TapabookCroutonStyle.CONFIRM).show();
}
public void croutonConfirm(String text){
    Crouton.makeText(this, text, TapabookCroutonStyle.CONFIRM).show();
}
public void croutonWarn(int stringId){
    Crouton.makeText(this, stringId, TapabookCroutonStyle.WARN).show();
}
public void croutonWarn(String text){
    Crouton.makeText(this, text, TapabookCroutonStyle.WARN).show();
}

Since I use ActionBarSherlock, my appTheme inherits from this, and not from bare. In another application, which used standard croutons, there were no problems. However, custom croutons will not be shown here. I tested it on 2.2 custom ROMs and 4.2 (Google version).

, , - Holo Colors Pre Holo Devices?, ( " ", ).

- , ?

: () , Style.ALERT, ... , R.color.mycolor R (: 0x7f06000c), Crouton, ... holo_red_light, alfa

<color name="verde_lima">#FFaaee22</color>
<color name="rojo_vivo">#FFE8110F</color>
<color name="naranja_resplandeciente">#FFFF6600</color>
<color name="amarillo_canario">#FFFFCC00</color>

.

+5
1

setBackgroundColorValue(...), . .

, setBackgroundColor(int resId), .

+3

All Articles