I have a TextView like below. I used this code to set gray color for a part of the text.
// Prepare result text.
final String resultText = text + "\n\n" + dictionaryName;
final SpannableString styledResultText = new SpannableString(resultText);
styledResultText.setSpan(new ForegroundColorSpan(Color.GRAY), text.length() + 2, text.length() + 2 + dictionaryName.length(), 0);
resultTextView.setText(styledResultText);
Now I want to set align for it. How to do? Android doesn't have any span class for alignment. I can't find out anything like "AlignmentSpan".