Skip to content
Burhanuddin Rashid edited this page Jun 13, 2019 · 4 revisions

You can add the text with input text and colorCode like this

mPhotoEditor.addText(inputText, colorCode);

It will take default fonts provided in the builder,If you want diffrent fonts for diffrent text you can set typeface with each text like this

mPhotoEditor.addText(mTypeface,inputText, colorCode);

In order to edit the text you need the view which you will reacive in you PhotoEditor callback.This callback will trigger when you Long Press the added text

mPhotoEditor.setOnPhotoEditorListener(new OnPhotoEditorListener() {
           @Override
           public void onEditTextChangeListener(View rootView, String text, int colorCode) {
               
           }
       });

Now you can edit the text with a view like this

mPhotoEditor.editText(rootView, inputText, colorCode);

Customize Text using TextStyleBuilder

  • Added Text style builder for add and edit text
new TextStyleBuilder()
      .withTextColor(123)
      .withTextSize(12f)
      .withGravity(3)
      .withTextFont(Typeface.DEFAULT)
      .withBackgroundColor(321)
      .withTextAppearance(144)
      .applyStyle(textView);
  • Apply style while adding text
TextStyleBuilder styleBuilder = new TextStyleBuilder()
                                      .withTextColor(colorCode);

mPhotoEditor.addText(inputText, styleBuilder);
Clone this wiki locally