首先,在assets資源文件下放入圖標字體庫。我這兒採用的是fontawesome-webfont.ttf然後, 在安卓中載入這個資源文件TypefacefontFace = Typeface.createFromAsset(context.getAssets(), "fontawesome-web...
首先,在assets資源文件下放入圖標字體庫。
我這兒採用的是fontawesome-webfont.ttf
然後, 在安卓中載入這個資源文件
Typeface fontFace = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
自定義一個string.xml文件存放這些字體庫的對應引用
<?xml version="1.0" encoding="utf-8"?> <!-- http://fortawesome.github.io/Font-Awesome/cheatsheet/ --> <resources> <string name="fa_500px"></string> <string name="fa_adjust"></string> <string name="fa_adn"></string> <string name="fa_align_center"></string> <string name="fa_align_justify"></string> <string name="fa_align_left"></string> <string name="fa_align_right"></string> <string name="fa_amazon"></string> <string name="fa_ambulance"></string> <string name="fa_anchor"></string> <string name="fa_android"></string> <string name="fa_angellist"></string> <string name="fa_angle_double_down"></string> <string name="fa_angle_double_left"></string> <string name="fa_angle_double_right"></string> <string name="fa_angle_double_up"></string> <string name="fa_angle_down"></string> <string name="fa_angle_left"></string> <string name="fa_angle_right"></string> <string name="fa_angle_up"></string> <string name="fa_apple"></string> <string name="fa_archive"></string> <string name="fa_area_chart"></string> <string name="fa_arrow_circle_down"></string> <string name="fa_arrow_circle_left"></string> <string name="fa_arrow_circle_o_down"></string> <string name="fa_arrow_circle_o_left"></string> <string name="fa_arrow_circle_o_right"></string> <string name="fa_arrow_circle_o_up"></string> <string name="fa_arrow_circle_right"></string> <string name="fa_arrow_circle_up"></string> <string name="fa_arrow_down"></string> <string name="fa_arrow_left"></string> <string name="fa_arrow_right"></string> <string name="fa_arrow_up"></string> <string name="fa_arrows"></string> <string name="fa_arrows_alt"></string> <string name="fa_arrows_h"></string> <string name="fa_arrows_v"></string> <string name="fa_asterisk"></string> <string name="fa_at"></string> <string name="fa_automobile"></string> <string name="fa_backward"></string> <string name="fa_balance_scale"></string> <string name="fa_ban"></string> <string name="fa_bank"></string> <string name="fa_bar_chart"></string> <string name="fa_bar_chart_o"></string> <string name="fa_barcode"></string> <string name="fa_bars"></string> <string name="fa_battery_0"></string> <string name="fa_battery_1"></string> <string name="fa_battery_2"></string> <string name="fa_battery_3"></string> <string name="fa_battery_4"></string> <string name="fa_battery_empty"></string> <string name="fa_battery_full"></string> <string name="fa_battery_half"></string> <string name="fa_battery_quarter"></string> <string name="fa_battery_three_quarters"></string> <string name="fa_bed"></string> <string name="fa_beer"></string> <string name="fa_behance"></string> <string name="fa_behance_square"></string> <string name="fa_bell"></string> <string name="fa_bell_o"></string> <string name="fa_bell_slash"></string> <string name="fa_bell_slash_o"></string> <string name="fa_bicycle"></string> <string name="fa_binoculars"></string> <string name="fa_birthday_cake"></string> <string name="fa_bitbucket"></string> <string name="fa_bitbucket_square"></string> <string name="fa_bitcoin"></string> <string name="fa_black_tie"></string> <string name="fa_bluetooth"></string> <string name="fa_bluetooth_b"></string> <string name="fa_bold"></string> <string name="fa_bolt"></string> <string name="fa_bomb"></string> <string name="fa_book"></string> <string name="fa_bookmark"></string> <string name="fa_bookmark_o"></string> <string name="fa_briefcase"></string> <string name="fa_btc"></string> <string name="fa_bug"></string> <string name="fa_building"></string> <string name="fa_building_o"></string> <string name="fa_bullhorn"></string> <string name="fa_bullseye"></string> <string name="fa_bus"></string> <string name="fa_buysellads"></string> <string name="fa_cab"></string> <string name="fa_calculator"></string> <string name="fa_calendar"></string> <string name="fa_calendar_check_o"></string> <string name="fa_calendar_minus_o"></string> <string name="fa_calendar_o"></string> <string name="fa_calendar_plus_o"></string> <string name="fa_calendar_times_o"></string> <string name="fa_camera"></string> <string name="fa_camera_retro"></string> <string name="fa_car"></string> <string name="fa_caret_down"></string> <string name="fa_caret_left"></string> <string name="fa_caret_right"></string> <string name="fa_caret_square_o_down"></string> <string name="fa_caret_square_o_left"></string> <string name="fa_caret_square_o_right"></string> <string name="fa_caret_square_o_up"></string> <string name="fa_caret_up"></string> <string name="fa_cart_arrow_down"></string> <string name="fa_cart_plus"></string> <string name="fa_cc"></string> <string name="fa_cc_amex"></string> <string name="fa_cc_diners_club"></string> <string name="fa_cc_discover"></string> <string name="fa_cc_jcb"></string> <string name="fa_cc_mastercard"></string> <string name="fa_cc_paypal"></string> <string name="fa_cc_stripe"></string> <string name="fa_cc_visa"></string> <string name="fa_certificate"></string> <string name="fa_chain"></string> <string name="fa_chain_broken"></string> <string name="fa_check"></string> <string name="fa_check_circle"></string> <string name="fa_check_circle_o"></string> <string name="fa_check_square"></string> <string name="fa_check_square_o"></string> <string name="fa_chevron_circle_down"></string> <string name="fa_chevron_circle_left"></string> <string name="fa_chevron_circle_right"></string> <string name="fa_chevron_circle_up"></string> <string name="fa_chevron_down"></string> <string name="fa_chevron_left"></string> <string name="fa_chevron_right"></string> <string name="fa_chevron_up"></string> <string name="fa_child"></string> <string name="fa_chrome"></string> <string name="fa_circle"></string> <string name="fa_circle_o"></string> <string name="fa_circle_o_notch"></string> <string name="fa_circle_thin"></string> <string name="fa_clipboard"></string> <string name="fa_clock_o"></string> <string name="fa_clone"></string> <string name="fa_close"></string> <string name="fa_cloud"></string> <string name="fa_cloud_download"></string> <string name="fa_cloud_upload"></string> <string name="fa_cny"></string> <string name="fa_code"></string> <string name="fa_code_fork"></string> <string name="fa_codepen"></string> <string name="fa_codiepie"></string> <string name="fa_coffee"></string> <string name="fa_cog"></string> <string name="fa_cogs"></string> <string name="fa_columns"></string> <string name="fa_comment"></string> <string