How Android displays custom fonts in the idea Eclipse UI Editor Preview

Source: Internet
Author: User

How Android displays custom fonts in the idea Eclipse UI Editor Preview

    1. The font to be displayed will be copied to. Android-sdk/platforms/android-[version]/data/fonts folder below

        For example: Fontawesome-regular.ttf

    2. Under Android-sdk/platforms/android-[version]/data/fonts, open  fallback_fonts.xml

      At the end of the add:

          <family>

              <FILESET>

                  < File>, " Span style= "Color:rgb (255,0,0);" >[the file name that is copied to the file, such as: Fontawesome-regular.ttf] </file>

              </fileset>

          </family

      Then use the following style code in your custom view:

 if  (!isineditmode ())  {             if  (null == mfontawesome)  {                 mfontawesome = typeface.createfromasset (Context.getAssets (),   "Fonts/fontawesome-webfont.ttf");             }        } else {             try {                 /**                  *  need to install fontawesome This SDK in Androidsdk, installation method See  http://www.hianzuo.com                  */       &nBsp;         mfontawesome = typeface.create (" Fontawesome ",  typeface.normal);             }  catch  (exception e)  {                 throw new runtimeexception (e);             }        }         settypeface (Mfontawesome);


This article is from the "hiandroid Studio" blog, be sure to keep this source http://hiandroidstudio.blog.51cto.com/5902332/1573867

How Android displays custom fonts in the idea Eclipse UI Editor Preview

Related Article

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.