2017-09-19 12 views

答えて

2

おそらくバグや相互排除です。

textAllCapsが設定されている場合TextViewは、他のすべてのスタイリングとスパンソーステキストCharSequenceが緩んになり、テキスト、プレーンStringsに変換を取るTransformationMethodを適用します。

あなたがプログラム的に(ナイーブKotlin)のようにそれをだますことができます。

val text = textView.text // at this point allCaps is applied so text is caps 
textView.setAllCaps(false) // remove the allCaps 
val spannable = SpannableString(text) // create new spannable with allCapped text 
spannable.setSpan(RelativeSizeSpan(1f), 0, text.length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE) 
textView.text = spannable //set it. 

別のアプローチは、設定されているすべてのテキストのためのあなたのスパンを適用する独自のTransformationMethodを作成しています。

関連する問題