以下のような TextView があります。このコードを使用して、テキストの一部に灰色を設定しました。
// 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);
今、私はそれに合わせて設定したいと思います。実行する方法?Android には、アライメント用のスパン クラスがありません。「AlignmentSpan」のようなものは見つかりません。