問題タブ [spannable]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - SpannableString setSpan() の色付けに一貫性がありませんか?
文字列 1 の色 (例: 赤) の母音のみに色を付け、別の母音以外 (例: 青) に色を付けようとしています。しかし、SpannableString setSpan() メソッドは、各文字を反復するときに一貫性がありません。色付けが正しくないことを除いて、ログに記録された出力を確認したように、関数は誓いと非誓いを正しく検出しています。
android - スパナブルを返し、それをテキストビューの文字列に追加する関数
文字列「単語」を引数として取り、スパンスタイリングを文字列に適用し、それをスパン可能な文字列として返す関数を作成しようとしてい""+insert+""
ますTextView
. これについてご提供いただけるご支援をよろしくお願いいたします。
これが私がこれまで持っている機能です。
スパン可能なインラインをテキストと一緒に表示するコード。
アプリケーションがスタイリングなしでテキストをロードするか、アプリがクラッシュします。何が間違っているのかわかりませんが、fromHtml テキストとスパン可能オブジェクトの混合に関係があると思います。回避策はありますか?
を削除してHtml.fromHtml()
、テキスト全体を関数でラップするとfr()
機能します。太字の青いテキストが表示されます。しかし、特定の単語だけにスタイルを設定できるようにする必要があります...多言語サポートのために、vars をハードコーディングする代わりに、string.xml ファイルから vars を参照できると便利です。
android - スパン可能な文字列の Android カスタム結合スパン
TypefaceSpan + RelativeSizeSpan など、さまざまなタイプのスパンを組み合わせたカスタム スパンを作成するにはどうすればよいでしょうか。テキストのフォントとサイズを変更する「Footnote」や「Header2」などの論理スパンを作成したいと考えています。
android - Combining Spannable with String.format()
Suppose you have the following string:
Suppose you want to end up with this string, but also have a particular Span
set for any word replaced by String.format
.
For instance, we also want to do the following:
Is there a robust way of getting to know the start indices of old
and tan
?
Note that just searching for 'old' returns the 'old' in 'cold', so that won't work.
What will work, I guess, is searching for %[0-9]$s
beforehand, and calculating the offsets to account for the replacements in String.format
. This seems like a headache though, I suspect there might be a method like String.format
that is more informative about the specifics of its formatting. Well, is there?
android - Android で SpannableStringBuilder イメージを処理する
選択した連絡先にクローズ マーク イメージEditText
を追加するアプリケーションを開発しています。そのクローズ マーク イメージをクリックすると、連絡先を削除する必要があります。クローズ マーク イメージを表示するまでのコードは完成しましたが、それらのクローズ マーク イメージを処理する方法がわかりません。方法を教えてください。
私のコード: