私は以下のようなTextViewを持っています。 このコードを使用して、テキストの一部の灰色を設定しました。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"のようなものは見つけられません。
いいえ、つまり、黒いテキストは左揃え、灰色のテキストは右揃えです。私はそれを「マルチプルアラインメント」と呼びます。 :) – Emerald214
結果テキストから黒のテキストを分離する必要があります(別々の2つのテキストビューがあります)。 –