In my application, I use 3 AlignmentSpan.Standard: center, normal, contrast. To keep it simple, let's call these paragraphs as follows: a paragraph with left alignment is the first paragraph, a paragraph with central alignment is the second paragraph, and a paragraph with right alignment is the third paragraph.
For example, the user creates 3 paragraphs. After that, the user uses LeadingMarginSpan.Standard for the second paragraph to get the indent. When indentation is applied, the first paragraph exits the EditText for a certain number of pixels, and the second paragraph is centered.
When the user clicks in the first paragraph, everything is in order, all paragraphs remain in the desired position, and the second paragraph remains indented. If you click the second paragraph, all paragraphs will go to the left side.
the code:
EditText et = (EditText)findViewById(R.id.et);
et.setText("ab\nab\nab");
AlignmentSpan.Standard normal = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_NORMAL);
AlignmentSpan.Standard center = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER);
AlignmentSpan.Standard opposite = new AlignmentSpan.Standard(Layout.Alignment.ALIGN_OPPOSITE);
et.getEditableText().setSpan(normal, 0, 3, Spanned.SPAN_PARAGRAPH);
et.getEditableText().setSpan(center, 3, 6, Spanned.SPAN_PARAGRAPH);
et.getEditableText().setSpan(opposite, 6, et.length(), Spanned.SPAN_PARAGRAPH);
LeadingMarginSpan.Standard indent = new LeadingMarginSpan.Standard(20);
et.getEditableText().setSpan(indent, 3,6, Spanned.SPAN_PARAGRAPH);
Select the first align:
Select the second align:

Edit:
https://www.youtube.com/watch?v=Ea9HJEmEeZA&feature=youtu.be