How to Use iconfont in Android, androidiconfont
1. iconfont
Iconfont is both an icon and a font. Specifically, it should be an icon displayed in the font form. Unlike the icon in the traditional image format, this icon is displayed in a font, so it is very convenient to change the size, color, and background color.
2. Use method 2.1 to download resources
Resource Source: http://www.androidicons.com/
Find the download link as instructed. Download and decompress the package, find the iconfont/font, and copy the four files to the assets Directory of the Android project. Find glyphs/glyphs.html. Because it will be used later, copy it to the assets Directory.
2.2 add icon
You can add TextView, Button, and other controls here. When setText () is used, the code corresponding to the icon is passed as a parameter. To the code corresponding to the map, open glyphs.html, find the icon you want to add, and copy the last line below, for example, "& #59428 ;".
2.3 set the font (Typeface)
Typeface iconTypeface = Typeface. createFromAsset (getAssets (), "androidicons. ttf"); textView = (TextView) findViewById (R. id. iconView); textView. setTypeface (iconTypeface );
Typeface. createFromAssets () the first parameter is the AssetManager object, which is obtained through getAssets (). The second parameter is the path. As shown in the Code, the path is assets/androidicons. ttf ".
Note: When I use eclipse, I cannot see the added icon in the preview. I can only see it in the simulator, and I don't know if it is a problem with eclipse.