Android Font Awesome Font icons
You can use all the features provided by CSS to change them, including the size, color, shadow, or any other supported effects. Only one Font Awesome Font contains all image icons related to webpages. A zoomed vector graph presents a perfect icon at any size. The Font Awesome vector icon will make your website shine on the retina-level high-split screen.
So, can a powerful web font icon library be used on Android? The answer is yes.
First we download the latest library from the URL above the article, unzip it, and then find the fontawesome-webfont.ttf under the fonts directory, copy it to our project directory assets Directory, then download a string resource from github and put it in the values directory under the res directory,
See before coding
We can see that we didn't use an image to achieve this effect. All these depend on fonts. First, we create custom fonts.
Typeface font = Typeface.createFromAsset(getAssets(), fontawesome-webfont.ttf);
Then there is the layout.
Set the font for each TextView
private void initView() { 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 Icon size and color, you only need to modify the font size and color, that is, you only need to modify the textSize and textColor of TextView.
More results will be available for you to discover.