Comment rajouter bandeau noir comme snapchat
lukas6410
-
BunoCS Messages postés 15952 Date d'inscription Statut Modérateur Dernière intervention -
BunoCS Messages postés 15952 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour, je cherche a placer un bandeau noir derriere le texte voici la fonction qui dessine le texte
public void drawMultilineTextToBimap(Context context,String text,Bitmap bitmap){ Resources resources = context.getResources(); float scale = resources.getDisplayMetrics().density; Bitmap.Config bitmapConfig = bitmap.getConfig(); if (bitmapConfig == null){ bitmapConfig = Bitmap.Config.ARGB_8888; } Canvas canvas = new Canvas(bitmap); //draw rect text Paint paintRect = new Paint(); paintRect.setColor(Color.BLACK); int heightrect = 100; int toprect = (bitmap.getHeight() - heightrect); int bottomRect = (bitmap.getHeight() + heightrect); canvas.drawRect(30, 30, 80, 80, paintRect); TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); paint.setColor(Color.WHITE); paint.setTextSize((int) (100 * scale)); paint.setShadowLayer(1f, 0f, 1f, Color.BLACK); int textWidth = canvas.getWidth() - (int) (16 * scale); // init StaticLayout for text StaticLayout textLayout = new StaticLayout( text, paint, textWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); // get height of multiline text int textHeight = textLayout.getHeight(); // get position of text's top left corner float x = (bitmap.getWidth() - textWidth)/2; float y = (bitmap.getHeight() - textHeight)/2; // draw text to the Canvas center canvas.save(); canvas.translate(x, y); textLayout.draw(canvas); canvas.restore(); }
Configuration: Windows / Firefox 98.0
A voir également:
- Comment rajouter bandeau noir comme snapchat
- Ecran noir pc - Guide
- Point vert snapchat ✓ - Forum Snapchat
- Comment installer snapchat - Télécharger - Messagerie
- Comment creer un compte snapchat - Guide
- Croix snapchat ✓ - Forum Snapchat