Created
April 15, 2022 08:40
-
-
Save massimilianochiodi/0865a53b7bfd2017d032c8f8bb17584a to your computer and use it in GitHub Desktop.
Sample create Bitmap icon with text (Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Bitmap icogen(int tipo, Context context) { | |
String testo = ""; | |
IconGenerator icg = new IconGenerator( context ); | |
icg.setBackground(ContextCompat.getDrawable(context, R.drawable.amu_bubble_mask ) ); | |
if (tipo == 1) { | |
icg.setColor( R.color.nero ); | |
icg.setStyle( IconGenerator.STYLE_GREEN ); | |
testo = "Varco"; | |
} else if (tipo == 2) { | |
icg.setColor( R.color.bianco ); | |
icg.setStyle( IconGenerator.STYLE_RED ); | |
testo = "Stop"; | |
} else if (tipo == 3) { | |
icg.setColor( R.color.nero ); | |
icg.setStyle( IconGenerator.STYLE_PURPLE ); | |
testo = "Inizio"; | |
} else if (tipo == 4) { | |
icg.setColor( R.color.bianco ); | |
icg.setStyle( IconGenerator.STYLE_RED ); | |
testo = "Selezionato"; | |
} | |
Bitmap icona = icg.makeIcon( testo ); | |
return icona; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment