For Font Awesome, see Http://fontawesome.dashgame.com/,Font awesome provides scalable vector icons that can be changed using all the features provided by CSS, including: size, color, Shadow, or any other supported effect. Only a font awesome font contains all the image icons associated with the Web page. Scalable Vector Graphics give you the perfect icon, regardless of size. Font Awesome's vector icon will make your site shine on the retina-level high-split screen.
So, a really powerful Web page font icon Library can be used on Android, the answer is yes.
First we download the latest library from the URL in front of the article, Unzip and then find the Fontawesome-webfont.ttf in the fonts directory, copy it to our project directory assets directory, and then download a string resource from GitHub to the values directory under the Res directory, see https:// Github.com/liltof/font-awsome-for-android
Look before you start coding
From the see, we did not use a picture, to achieve this effect, it all depends on the font, first, create a custom font
Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf");
Then the layout, the simple layout of the next
<linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns:tools =" Http://schemas.android.com/tools " android:layout_width = "match_parent" android:layout_height =" match_parent " android:orientation =" vertical " tools:context = "${relativepackage}.${activityclass } "; <linearlayoutandroid:layout_width="Match_parent"android:layout_height ="0DP"android:layout_weight="1"android:background="#fff" > </linearlayout> <linearlayout android: Layout_width = "match_parent" android:layout_ Height = "60DP" android:background =< Span class= "Hljs-value" > "#eee" android:orientation =" horizontal "; <textview android:id= "@+id/tab1" android:layout_width = "0DP" android:layout_height =" match_parent " android:layout_weight =" 1 " android:gravity =" center " android:text = "@string/fa_android" android:textcolor = "#1fa67a" android:textsize =" 20sp "; </textview ; <textview android:id= "@+id/tab2" android:layout_width = "0DP" android:layout_height =" match_parent " android:layout_weight =" 1 " android:gravity =" center " android:text = "@string/fa_windows" android:textcolor = "#1fa67a" android:textsize =" 20sp "; </textview ; <textview android:id= "@+id/tab3" android:layout_width = "0DP" android:layout_height =" match_parent " android:layout_weight =" 1 " android:gravity =" center " android:text = "@string/fa_linux" android:textcolor = "#1fa67a" android:textsize =" 20sp "; </TextView> </linearlayout></linearlayout>
Then set the font for each TextView
privatevoidinitView() { Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf"); tab1 = (TextView) findViewById(R.id.tab1); tab2 = (TextView) findViewById(R.id.tab2); tab3 = (TextView) findViewById(R.id.tab3); tab1.setTypeface(font); tab2.setTypeface(font); tab3.setTypeface(font); }
If you want to change the size and color of the icon, just change the font size and color, that is, just modify the TextView textsize and TextColor.
More use effect to you to find.
SOURCE download
http://download.csdn.net/detail/sbsujjbcy/8567213
Android uses font awesome fonts icon