當前位置: 首頁>>代碼示例>>Java>>正文


Java Paint.setFakeBoldText方法代碼示例

本文整理匯總了Java中android.graphics.Paint.setFakeBoldText方法的典型用法代碼示例。如果您正苦於以下問題:Java Paint.setFakeBoldText方法的具體用法?Java Paint.setFakeBoldText怎麽用?Java Paint.setFakeBoldText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.setFakeBoldText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import android.graphics.Paint; //導入方法依賴的package包/類
private void apply(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.getShader();

    paint.setTypeface(tf);
}
 
開發者ID:pan2yong22,項目名稱:AndroidUtilCode-master,代碼行數:23,代碼來源:SpanUtils.java

示例2: init

import android.graphics.Paint; //導入方法依賴的package包/類
private void init() {
    ateKey = Helper.getATEKey(getContext());
    accentColor = Config.accentColor(getContext(), ateKey);
    textPaint = new Paint();
    textPaint.setColor(labelColor);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTextSize(labelSize);
    textPaint.setFakeBoldText(true);
    textPaint.setTextAlign(Paint.Align.CENTER);
    circlePaint = new Paint();
    circlePaint.setColor(progressSecondaryColor);
    circlePaint.setStrokeWidth(progressSecondaryStrokeWidth);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint2 = new Paint();
    circlePaint2.setColor(accentColor);
    circlePaint2.setTextAlign(Paint.Align.CENTER);
    circlePaint2.setStrokeWidth(progressPrimaryStrokeWidth);
    circlePaint2.setStyle(Paint.Style.FILL);
    linePaint = new Paint();
    linePaint.setColor(indicatorColor);
    linePaint.setStrokeWidth(indicatorWidth);

    oval = new RectF();

}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:26,代碼來源:EqView.java

示例3: applyCustomTypeFace

import android.graphics.Paint; //導入方法依賴的package包/類
private void applyCustomTypeFace(Paint paint, FontFamily tf) {

		paint.setAntiAlias(true);
		
		paint.setTypeface(tf.getDefaultTypeface());

		if (bold) {
			if (tf.isFakeBold()) {
				paint.setFakeBoldText(true);
			} else {
				paint.setTypeface(tf.getBoldTypeface());
			}
		}

		if (italic) {
			if (tf.isFakeItalic()) {
				paint.setTextSkewX(-0.25f);
			} else {
				paint.setTypeface(tf.getItalicTypeface());
			}
		}

		if (bold && italic && tf.getBoldItalicTypeface() != null) {
			paint.setTypeface(tf.getBoldItalicTypeface());
		}
	}
 
開發者ID:SysdataSpA,項目名稱:SDHtmlTextView,代碼行數:27,代碼來源:FontFamilySpan.java

示例4: applyCustomTypeFace

import android.graphics.Paint; //導入方法依賴的package包/類
private static void applyCustomTypeFace(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(tf);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:CustomTypefaceSpan.java

示例5: apply

import android.graphics.Paint; //導入方法依賴的package包/類
private void apply(final Paint paint)
{
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0)
    {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0)
    {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
開發者ID:cdjalel,項目名稱:QuranKeyboard,代碼行數:19,代碼來源:CustomTypefaceSpan.java

示例6: initPaintTools

import android.graphics.Paint; //導入方法依賴的package包/類
private void initPaintTools() {

    satValPaint = new Paint();
    satValTrackerPaint = new Paint();
    hueAlphaTrackerPaint = new Paint();
    alphaPaint = new Paint();
    alphaTextPaint = new Paint();
    borderPaint = new Paint();

    satValTrackerPaint.setStyle(Style.STROKE);
    satValTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    satValTrackerPaint.setAntiAlias(true);

    hueAlphaTrackerPaint.setColor(sliderTrackerColor);
    hueAlphaTrackerPaint.setStyle(Style.STROKE);
    hueAlphaTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    hueAlphaTrackerPaint.setAntiAlias(true);

    alphaTextPaint.setColor(0xff1c1c1c);
    alphaTextPaint.setTextSize(DrawingUtils.dpToPx(getContext(), 14));
    alphaTextPaint.setAntiAlias(true);
    alphaTextPaint.setTextAlign(Align.CENTER);
    alphaTextPaint.setFakeBoldText(true);

  }
 
開發者ID:Blankeer,項目名稱:MDWechat,代碼行數:26,代碼來源:ColorPickerView.java

示例7: updatePaintTypeface

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * Updates typeface setting for the given <var>paint</var> to the specified one.
 *
 * @param paint    The paint to be updated.
 * @param typeface The desired typeface. May be {@code null} to resolve instance of typeface
 *                 from the specified style.
 * @param style    The desired text style used to resolve proper instance of typeface.
 * @return {@code True} if paint's typeface setting has changed, {@code false} otherwise.
 * @see Paint#setTypeface(Typeface)
 */
public static boolean updatePaintTypeface(@NonNull Paint paint, @Nullable Typeface typeface, @TextStyle int style) {
	if (style > 0) {
		if (typeface == null) {
			typeface = Typeface.defaultFromStyle(style);
		} else {
			typeface = Typeface.create(typeface, style);
		}
		final int typefaceStyle = typeface != null ? typeface.getStyle() : 0;
		final int need = style & ~typefaceStyle;
		paint.setFakeBoldText((need & Typeface.BOLD) != 0);
		paint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
		paint.setTypeface(typeface);
	} else {
		paint.setFakeBoldText(false);
		paint.setTextSkewX(0);
		paint.setTypeface(typeface);
	}
	return true;
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:30,代碼來源:TextAppearance.java

示例8: drawNumbers

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * Function to draw number in the bitmap
 *
 * @param number Number to draw
 * @return the new bitmap after draw
 */
public Bitmap drawNumbers(String number) {
    float fontAndPadding = getResources().getDimension(R.dimen.draw_number);
    Paint paint = new Paint();
    paint.setTextSize(fontAndPadding);
    paint.setColor(Color.WHITE);
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    paint.setFakeBoldText(true);
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_repeat);
    Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(mutableBitmap);
    canvas.drawText(number, bitmap.getWidth() - fontAndPadding, fontAndPadding, paint);
    return mutableBitmap;
}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:22,代碼來源:QuranPageReadActivity.java

示例9: applyTypeface

import android.graphics.Paint; //導入方法依賴的package包/類
public static void applyTypeface(Context context, Paint v) {
    if (v.getTypeface() == null) {
        v.setTypeface(getNormal(context));
        return;
    }
    switch (v.getTypeface().getStyle()) {
        case Typeface.BOLD:
            v.setTypeface(getNormal(context));
            v.setFakeBoldText(true);
            break;
        default:
            v.setTypeface(getNormal(context));
            break;
        case Typeface.ITALIC:
            v.setTypeface(getNormal(context));
            v.setTextSkewX(-0.25f);
            break;
        case Typeface.BOLD_ITALIC:
            v.setTypeface(getNormal(context));
            v.setFakeBoldText(true);
            v.setTextSkewX(-0.25f);
            break;
    }
}
 
開發者ID:iPanelkegy,項目名稱:MobileMedia,代碼行數:25,代碼來源:Icon.java

示例10: addWaterMark

import android.graphics.Paint; //導入方法依賴的package包/類
/**
 * @param src Original image
 * @param context needed to fetch resources
 * @return new bitmap resource containing the watermark
 */
public static Bitmap addWaterMark(Bitmap src, Context context) {

    int height = src.getHeight() + UiUtils.dpToPx(32 + 8);
    int width = src.getWidth();

    Bitmap result = Bitmap.createBitmap(width, height, src.getConfig());
    Canvas canvas = new Canvas(result);
    canvas.drawBitmap(src, 0, 0, null);

    int darkGrey = context.getResources().getColor(R.color.grey_900);
    Bitmap appIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);
    appIcon = Bitmap.createScaledBitmap(appIcon, UiUtils.dpToPx(32), UiUtils.dpToPx(32), false);

    Paint backgroundPaint = new Paint();
    backgroundPaint.setColor(Color.WHITE);
    backgroundPaint.setAntiAlias(true);
    backgroundPaint.setShadowLayer(6, 2, 2, darkGrey);

    Paint textPaint = new Paint();
    textPaint.setColor(darkGrey);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(UiUtils.dpToPx(16));
    textPaint.setFakeBoldText(true);

    Paint appIconPaint = new Paint();
    appIconPaint.setAntiAlias(true);
    appIconPaint.setFilterBitmap(true);
    appIconPaint.setDither(true);

    float srcHeight = src.getHeight();
    int _4dp = UiUtils.dpToPx(4);

    String watermarkText = context.getString(R.string.app_name);
    Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
    float watermarkTextY = srcHeight + (height - srcHeight) / 2f + (fontMetrics.descent - fontMetrics.ascent) / 2f;

    canvas.drawRect(0, srcHeight, width, height, backgroundPaint);
    canvas.drawText(watermarkText, (_4dp) * 2 + appIcon.getWidth(), watermarkTextY, textPaint);
    canvas.drawBitmap(appIcon, _4dp, _4dp + srcHeight, appIconPaint);

    appIcon.recycle();
    src.recycle();
    return result;
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:50,代碼來源:UiUtils.java

示例11: flagDate

import android.graphics.Paint; //導入方法依賴的package包/類
private void flagDate(Canvas canvas, String flag, @ColorInt int clr, int y, int x) {
    Paint flagP = new Paint();
    flagP.setAntiAlias(true);
    float flagTS = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics());
    flagP.setTextSize(flagTS);
    flagP.setStyle(Style.FILL);
    flagP.setColor(clr);
    flagP.setTextAlign(Align.CENTER);
    flagP.setFakeBoldText(false);
    canvas.drawText(flag, x, y - DAY_ROW_MARGIN - DAY_NUM_HALF_WIDTH, flagP);
}
 
開發者ID:sieml,項目名稱:CalendarCheck,代碼行數:12,代碼來源:SimpleMonthView.java

示例12: initSetting

import android.graphics.Paint; //導入方法依賴的package包/類
/******************
 * common
 ******************/

private void initSetting(Context context, AttributeSet attrs) {
    mOnTouchingLetterChangeListener = getDummyListener();
    mNavigators = new ArrayList<>(0);
    mFocusIndex = -1;

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndexBar);
    float textSize = typedArray.getDimension(R.styleable.IndexBar_letterSize, 8);
    int letterColor = typedArray.getColor(R.styleable.IndexBar_letterColor,
            ContextCompat.getColor(getContext(), android.R.color.white));
    mLetterSpacingExtra = typedArray.getFloat(R.styleable.IndexBar_letterSpacingExtra, 1.4f);
    int focusLetterColor = typedArray.getColor(R.styleable.IndexBar_focusLetterColor,
            ContextCompat.getColor(getContext(), android.R.color.white));
    typedArray.recycle();

    mPaint = new Paint();
    mPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mPaint.setAntiAlias(true);
    mPaint.setColor(letterColor);
    mPaint.setTextSize(textSize);

    mFocusPaint = new Paint();
    mFocusPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mFocusPaint.setAntiAlias(true);
    mFocusPaint.setFakeBoldText(true);
    mFocusPaint.setTextSize(textSize);
    mFocusPaint.setColor(focusLetterColor);

}
 
開發者ID:hgDendi,項目名稱:ContactsList,代碼行數:33,代碼來源:IndexBar.java

示例13: TextDrawable

import android.graphics.Paint; //導入方法依賴的package包/類
private TextDrawable(Builder builder) {
    super(builder.shape);

    // shape properties
    shape = builder.shape;
    height = builder.height;
    width = builder.width;
    radius = builder.radius;

    // text and color
    text = builder.toUpperCase ? builder.text.toUpperCase() : builder.text;
    color = builder.color;

    // text paint settings
    fontSize = builder.fontSize;
    textPaint = new Paint();
    textPaint.setColor(builder.textColor);
    textPaint.setAntiAlias(true);
    textPaint.setFakeBoldText(builder.isBold);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTypeface(builder.font);
    textPaint.setTextAlign(Paint.Align.CENTER);
    textPaint.setStrokeWidth(builder.borderThickness);

    // border paint settings
    borderThickness = builder.borderThickness;
    borderPaint = new Paint();
    borderPaint.setColor(getDarkerShade(color));
    borderPaint.setStyle(Paint.Style.STROKE);
    borderPaint.setStrokeWidth(borderThickness);

    // drawable paint color
    Paint paint = getPaint();
    paint.setColor(color);

}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:37,代碼來源:TextDrawable.java

示例14: apply

import android.graphics.Paint; //導入方法依賴的package包/類
private void apply(final Paint paint) {
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
開發者ID:takahirom,項目名稱:DownloadableCalligraphy,代碼行數:16,代碼來源:CalligraphyTypefaceSpan.java

示例15: initPaintTools

import android.graphics.Paint; //導入方法依賴的package包/類
private void initPaintTools(){

		mSatValPaint = new Paint();
		mSatValTrackerPaint = new Paint();
		mHuePaint = new Paint();
		mHueTrackerPaint = new Paint();
		mAlphaPaint = new Paint();
		mAlphaTextPaint = new Paint();
		mBorderPaint = new Paint();


		mSatValTrackerPaint.setStyle(Style.STROKE);
		mSatValTrackerPaint.setStrokeWidth(2f * mDensity);
		mSatValTrackerPaint.setAntiAlias(true);

		mHueTrackerPaint.setColor(mSliderTrackerColor);
		mHueTrackerPaint.setStyle(Style.STROKE);
		mHueTrackerPaint.setStrokeWidth(2f * mDensity);
		mHueTrackerPaint.setAntiAlias(true);

		mAlphaTextPaint.setColor(0xff1c1c1c);
		mAlphaTextPaint.setTextSize(14f * mDensity);
		mAlphaTextPaint.setAntiAlias(true);
		mAlphaTextPaint.setTextAlign(Align.CENTER);
		mAlphaTextPaint.setFakeBoldText(true);


	}
 
開發者ID:Bregnet,項目名稱:TextView_CustomEdit_CustomColor,代碼行數:29,代碼來源:ColorPickerView.java


注:本文中的android.graphics.Paint.setFakeBoldText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。