TextView setTypeface - 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 setTypeface method.

This code example shows how to use the following methods:setLayoutParams, setText, setTextSize, setTypeface
8
CodeRank
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:setId, setLayoutParams, setGravity, setText, setTextColor
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:setText, setTextColor, setTextSize, setTypeface
 
        mFrameLayout = (FrameLayout)findViewById(R.id.frame_layout);
    } 
 
    private void showTelop() { 
        TextView telop = new TextView(this);
        telop.setText("TextViewをVideoViewに重ねます");
        telop.setTextColor(Color.RED);
        telop.setTextSize(40);
        telop.setTypeface(Typeface.DEFAULT, 1);
        mFrameLayout.addView(telop);
    } 
 
    public void onPickVideoButton(View view) {
        Intent intent = new Intent();
        intent.setType("video/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(intent, 1);
    } 
 
7
CodeRank
This code example shows how to use the following methods:setLayoutParams, setSingleLine, setText, setTextColor, setTextSize
		LayoutParams textLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
		textLayoutParams.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
		textLayoutParams.setMargins(0, 0, 0, 0);
		textLayout.setLayoutParams(textLayoutParams);
 
		textView = new TextView(getContext());
		textView.setSingleLine(true);
		 
		LayoutParams textParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		textParams.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
		 
		if(this.text != null) {
			textView.setText(text);
		} 
	 
		if(textSize > 0) {
			textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
		} 
		else { 
			textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);

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:setGravity, setLines, setTextColor, setTextSize, setTypeface
    /** 
     * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views. 
     * @param view the text view to be configured 
     */ 
    protected void configureTextView(TextView view) {
        view.setTextColor(textColor);
        view.setGravity(Gravity.CENTER);
        view.setTextSize(textSize);
        view.setLines(1);
        view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    } 
     
    /** 
     * Loads a text view from view 
     * @param view the text view or layout containing it 
     * @param textResource the text resource Id in layout 
     * @return the loaded text view 
     */ 
    private TextView getTextView(View view, int textResource) {
    	TextView text = null;
7
CodeRank
This code example shows how to use the following methods:setGravity, setLines, setTextColor, setTextSize, setTypeface
     * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views. 
     * @param view the text view to be configured 
     */ 
    protected void configureTextView(TextView view) {
        if (itemResourceId == TEXT_VIEW_ITEM_RESOURCE) {
            view.setTextColor(textColor);
            view.setGravity(Gravity.CENTER);
            view.setTextSize(textSize);
            view.setLines(1);
        } 
        if (textTypeface != null) {
            view.setTypeface(textTypeface);
        } else { 
            view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
        } 
    } 
     
    /** 
     * Loads a text view from view 
     * @param view the text view or layout containing it 
6
CodeRank
This code example shows how to use the following methods:setLayoutParams, setTextColor, setTextSize, setTypeface

Related TextView setTypeface Questions & Answers:

Other TextView setTypeface Examples

88:			TextView lblListHeader = (TextView) convertView
89:					.findViewById(R.id.lblListHeader);
90:			lblListHeader.setTypeface(null, Typeface.BOLD);
91:			lblListHeader.setText(headerTitle);
92:

Read More

21:	        // Applying font
22:	        txtGhost.setTypeface(tf);
23:	    }
24:	}
25:

Read More

setTypeface Method Overview
Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.
See Code Examples for other Android TextView Methods: