Back to project page Ocypode.
The source code is released under:
MIT License
If you think the Android project Ocypode 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.ocypode.component; /*from www .j a v a 2 s .c o m*/ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import com.ocypode.R; public class Typefaced { public static Typeface createTypeface(Context context, AttributeSet attrs) { TypedArray styledAttrs = context.obtainStyledAttributes(attrs,R.styleable.TypefacedTextView); String fontName = styledAttrs.getString(R.styleable.TypefacedTextView_typefaceTextView); styledAttrs.recycle(); if (fontName != null) { return Typeface.createFromAsset(context.getAssets(), "fonts/" + fontName); } return null; } }