これは失敗かもしれませんが、知っておく必要があります... :) Androidアプリケーションを開発しています.2つのタイプフェイスを1つのテキストビューに表示したいのですが、これは非常に便利であることがわかりました.タイプフェイススパンを拡張するカスタムタイプフェイススパン、私の理解によると、2つの単語を使用して次のようにスパン可能を作成しています
String firstWord = "first ";
String secondWord = "second";
// Create a new spannable with the two strings
Spannable spannable = new SpannableString(firstWord+secondWord);
次に、このようなカスタム スパンを使用して、2 つの書体をその単語に設定します
// Set the custom typeface to span over a section of the spannable object
spannable.setSpan( new CustomTypefaceSpan("sans-serif",CUSTOM_TYPEFACE), 0,
firstWord.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannable.setSpan( new CustomTypefaceSpan("sans-serif",SECOND_CUSTOM_TYPEFACE), rstWord.length(), secondWord.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
今私の質問です、私は大量のテキストを持っているので、テキストに直接スパンを入れることができれば、それは私たちにとってより簡単になります.私の必要に応じてテキストにスパンを直接入れることが可能<b>bold </b>
ですか?のようなカスタム書体スパンを使用するには<typeface1> sample </typeface1> <typeface2> Doc </typeface2>
。
私が必要としているのは、テキストに変更を直接適用するセットスパンがテキストに行うことです
それは可能ですか、可能であればテキストにスパンとして書く必要があるもの、どうすればこれを達成できますか..または私は完全に間違っていますか?
すべてをありがとう