Android Font Awesome Font icons

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.