siwangqishiq/ImageEditor-Android

Border box of Text not showing properly in CENTER or RIGHT text alignment

Opened this issue · 1 comments

Hi,
If we set the text alignment to center in TextStickerView then the border square box of text becomes broken.
You just have to change text alignment on this line and run the app then add text.

Screenshot_2020-04-04-12-20-32

i solved this issue with change below code in TextStickerView.java Line: 252

for (int i = 0; i < mTextContents.size(); i++) {
   int alignX = x;
   if (mPaint.getTextAlign() == Paint.Align.CENTER)
      alignX = (int) ((rect.left + rect.right)/2);

   else if (mPaint.getTextAlign() == Paint.Align.RIGHT)
      alignX = (int) rect.right;

   else if (mPaint.getTextAlign() == Paint.Align.LEFT)
      alignX = (int) rect.left;

   canvas.drawText(mTextContents.get(i), alignX, draw_text_y, mPaint);
   draw_text_y += text_height;
}