Font icon is mainly used to reduce .apk size and do not take much more memory for the image file, before we have used many images in your projects its may occur out of memory issue and project size also too high.
FontAwesome is an awesome tool for designers and developers which give us scalable vector icons that can be easily customized. You can style a FontAwesome icon as any other fonts such as size, color, shadow, animation, transition etc. FontAwesome offers more than 605 fonts icons in a single collection. You don't need JavaScript to run font awesome and it has infinite scalability which means every icon looks great and awesome at any size you define. Font awesome is free for commercial use and is also desktop friendly.
There
are 4 files for each icon: mdpi, hdpi, xhdpi, xxhdpi. Total size of
those 20 files is 33,8 kb (33824 b).
Approximately
6-8 kb for the one icon. But in some cases (when your icons have
quite much details) they can take around 10 kb per one icon.
So,
what about font size? Well, size of .ttf file which contains these
icons takes 2,3 kb (2280 b). This is just 6% from .png files size!
There is 30 kb saved only for 5 icons!
MainActivity
1. Download
fontawesome-webfont.ttf
file from this link.
2. Copied and pasted
fontawesome-webfont.ttf
into assests folder.
3.
Created an entry in strings.xml for each icon.
<string name="icon_heart"></string> <string name="icon_bitbucket"></string> <string name="icon_birthday"></string> <string name="icon_vimeo"></string>
4. View of my xml layout:<TextView android:id="@+id/textView_one" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_alignParentTop="true" android:layout_marginTop="50dp" android:textColor="@color/colorAccent" android:textSize="50dp" android:text="@string/icon_heart" />4. Loaded the font in my onCreate method and set it for the appropriate Views:
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome-webfont.ttf"); textViewOne = (TextView)findViewById( R.id.textView_one); textViewTwo = (TextView)findViewById( R.id.textView_two); textViewThree = (TextView)findViewById( R.id.textView_three); textViewFour = (TextView)findViewById( R.id.textView_four); textViewOne.setTypeface(font); textViewTwo.setTypeface(font); textViewThree.setTypeface(font); textViewFour.setTypeface(font);5. For more icons needed get it from this link.
Happy Coding....
14 comments
Write commentsI believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
Replyangularjs2-Training in sholinganallur
angularjs4-Training in sholinganallur
angularjs-Training in annanagar
angularjs2-Training in annanagar
After seeing your article I want to say that the presentation is very good and also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
ReplyData Science Training in Chennai | Data Science course in anna nagar
Data Science course in chennai | Data science course in Bangalore
Data Science course in marathahalli | Data Science course in btm
This is my 1st visit to your web... But I'm so impressed with your content. Good Job!
Replypython training in velachery | python training institute in chennai
You’ve written a really great article here. Your writing style makes this material easy to understand.. I agree with some of the many points you have made. Thank you for this is real thought-provoking content
Replyadvanced excel training in bangalore
Thanks for uploading your blog, it helps me a lot in different ways.
ReplySelenium training in chennai
Selenium training institute in Chennai
iOS Course Chennai
Digital Marketing Training in Chennai
salesforce administrator training in chennai
Salesforce certification Training in Chennai
Big Data Training in Chennai
Wow good to read this blog
Replymachine learning training institute in chennai
Thanks for providing wonderful information with us. Thank you so much.
ReplyMachine Learning Training Institute in chennai | Best machine learning Training in Chennai
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job,Keep it up.
ReplyTry Our Vashikaran Expert In Toronto Services and Get All the benefits of it in your life, we make All your Personal problems solved in just minutes.
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article. Thanks for sharing nice article about JAVA.
ReplyJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
The site was so nice, I found out about a lot of great things. I like the way you make your blog posts. Keep up the good work and may you gain success in the long run.
ReplyBig Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery
"Good Posting. Extra-ordinary way to narrate the concepts. Thanks for sharing..
ReplyDigital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery
"
Nice tips. Very innovative... Your post shows all your effort and great experience towards your work Your Information is Great if mastered very well.
ReplyAWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. Best of luck
ReplyJava training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
Great Article android based projects
ReplyJava Training in Chennai Project Center in Chennai Java Training in Chennai projects for cse The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai
EmoticonEmoticon