fontelloのアイコンをAndroidで使うと捗る
7kai Tasksでもお世話になっている http://fontello.com/ ですがAndroidでも活用できるか試してみた。
手順は以下のとおり
1. fontelloで好きなフォントを選択しダウンロード
2. fontello.ttfはassetsディレクトリ(無い場合は作る)の直下に置く
3. アイコンを表示するTextViewにsetTypefaceでfontello.ttfを指定
4. fontello-codes.cssの右コメント部分から該当アイコンの文字をコピーしsetTextに貼る
TextView actionIcon = (TextView) view.findViewById(R.id.action_icon); actionIcon.setTypeface(Typeface.createFromAsset(context.getAssets(), "fontello.ttf")); actionIcon.setText(""); // .icon-retweet:before { content: '\e801'; } /* '' */
文字化けしている文字をコピペで使うのが力技っぽくて良い、UTF-8って素晴らしい。