Created
November 20, 2013 05:34
-
-
Save nealsanche/7558253 to your computer and use it in GitHub Desktop.
A text view that loads a particular font at runtime.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.robotsandpencils.wclclottery.controls; | |
import android.content.Context; | |
import android.graphics.Typeface; | |
import android.util.AttributeSet; | |
import android.widget.TextView; | |
/** | |
* A textview that will show using Helvetica Neu | |
* Created by neal on 11/18/2013. | |
*/ | |
public class NeuTextView extends TextView { | |
public NeuTextView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
init(); | |
} | |
public NeuTextView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
init(); | |
} | |
public NeuTextView(Context context) { | |
super(context); | |
init(); | |
} | |
private void init() { | |
if (isInEditMode()) return; | |
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), | |
"fonts/HelveticaNeueLTStd-BlkCnO.otf"); | |
setTypeface(tf); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment