私のアプリケーションで素晴らしいフォントを1つのテキストビューに設定したいと思います。 私は以下のようにそれを使用し、それが正常に動作します:フォントAwesomeは直接文字列入力では機能しません
Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf");
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
awesomeButton.setText(MainActivity.this.getString(R.string.heart));
しかし、私はタラ、以下のようにそれを使用する場合、それは動作しません:
Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome/fonts/fontawesome-webfont.ttf");
TextView awesomeButton = (TextView)findViewById(R.id.awesome_button);
awesomeButton.setTypeface(font);
awesomeButton.setText("");
Html.fromHtmlを試してみてください? –
@HarshitTrivediは廃止されましたので、代わりにHtml.fromHtml(html、Html.FROM_HTML_MODE_LEGACY);を使用できます。詳細については、下記のリンクを参照してください。https://developer.android.com/reference/android/text/Html.html#FROM_HTML_MODE_COMPACT –