TextView getTypeface - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView getTypeface method.

This code example shows how to use the following methods:getTypeface, setTypeface
        imageCache = new LRUImageCache();
        imageLoader = new ImageLoader(networkQueue, imageCache);
    } 
 
	public void setFontFromPreference(TextView textView, int flags){
		if(flags < 0 && textView.getTypeface() != null){
			flags = textView.getTypeface().getStyle();
		}else{ 
			flags = Typeface.NORMAL;
		} 
		if(fonts.size() == 0){
			processFonts(); 
		} 
		if(currentFont != null){
			if(mPref.preferredFont.contains("mono")){
				switch(flags){
				case Typeface.BOLD:
					textView.setTypeface(currentFont, Typeface.MONOSPACE.BOLD);
					break; 
				case Typeface.ITALIC:

8
CodeRank
This code example shows how to use the following methods:getTextSize, getTypeface
     * @param numberOfDigits 
     * @return number width 
     */ 
    public static int getWidth(TextView view, int numberOfDigits) {
        Paint paint = new Paint();
        paint.setTypeface(view.getTypeface());
        paint.setTextSize(view.getTextSize());
        char[] text = new char[numberOfDigits];
        Arrays.fill(text, '0');
        return Math.round(paint.measureText(text, 0, text.length));
    } 
 
    /** 
     * Get octicons typeface 
     * 
     * @param context 
     * @return octicons typeface 
     */ 
    public static Typeface getOcticons(final Context context) {
        if (OCTICONS == null)
7
CodeRank
This code example shows how to use the following methods:getTypeface, setEllipsize, setSingleLine, setTextAppearance, setTypeface
    /** 
     * Returns the text view for the data label, creating it if necessary. 
     */ 
    public TextView getLabelView() {
        if (mLabelView == null) {
            mLabelView = new TextView(mContext);
            mLabelView.setSingleLine(true);
            mLabelView.setEllipsize(TruncateAt.MARQUEE);
            mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
            mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
            addView(mLabelView);
        } 
        return mLabelView;
    } 
 
    /** 
     * Adds or updates a text view for the data element. 
     */ 
    public void setData(char[] text, int size) {
        if (text == null || size == 0) {
7
CodeRank
This code example shows how to use the following methods:setVisibility, getTypeface, setEllipsize, setSingleLine, setText
7
CodeRank
This code example shows how to use the following methods:getPaintFlags, getTypeface, setTypeface
        mColumn1.setPadding(5, 0, 5, 0);
        mColumn2.setPadding(5, 0, 5, 0);
    } 
     
    private void updateTitle() { 
        Typeface tf = mColumn1.getTypeface();
        String title = " PS=" + mFontSize + " X="
                    + (1 + mTextScaleXDelta/SCALE_X_RANGE)
                    + " G=" + (mGamma/GAMMA_RANGE)
                    + " S=" + ((mColumn1.getPaintFlags() & Paint.SUBPIXEL_TEXT_FLAG) != 0 ? 1 : 0)
                    + " " + sTypefaceName[mFontIndex]
                    + " " + sStyleName[tf.getStyle()]
                    ; 
        setTitle(title);
    } 
     
    /** Called when it is time to initialize the activity state. */ 
    protected void onRestoreInstanceState(Bundle state) {
        super.onRestoreInstanceState(state);
    } 

6
CodeRank

Related TextView getTypeface Questions & Answers:

getTypeface Method Overview
See Code Examples for other Android TextView Methods: