Back to project page 50AndroidHacks.
The source code is released under:
Apache License
If you think the Android project 50AndroidHacks listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.yftx.AndroidHacks.sectionTipsAndTricks; /*from w ww . j a v a 2 s . c o m*/ import android.content.Context; import android.content.res.AssetManager; import android.graphics.Typeface; import android.util.AttributeSet; import android.widget.TextView; import java.io.File; /** * User: Liuzl * Date: 13-11-27 */ public class LEDTextView extends TextView { private static final String FONTS_FOLDER = "fonts"; private static final String FONT_DIGITAL_7 = FONTS_FOLDER + File.separator + "digital-7.ttf"; public LEDTextView(Context context) { super(context); } public LEDTextView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public LEDTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); AssetManager assets = context.getAssets(); final Typeface font = Typeface.createFromAsset(assets, FONT_DIGITAL_7); setTypeface(font); } }