当前位置: 首页>>代码示例>>Java>>正文


Java Paint.setTextScaleX方法代码示例

本文整理汇总了Java中android.graphics.Paint.setTextScaleX方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setTextScaleX方法的具体用法?Java Paint.setTextScaleX怎么用?Java Paint.setTextScaleX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.setTextScaleX方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initPaints

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaints() {
    paintOuterText = new Paint();
    paintOuterText.setColor(textColorOut);
    paintOuterText.setAntiAlias(true);
    paintOuterText.setTypeface(Typeface.MONOSPACE);
    paintOuterText.setTextSize(textSize);

    paintCenterText = new Paint();
    paintCenterText.setColor(textColorCenter);
    paintCenterText.setAntiAlias(true);
    paintCenterText.setTextScaleX(1.1F);
    paintCenterText.setTypeface(Typeface.MONOSPACE);
    paintCenterText.setTextSize(textSize);

    paintIndicator = new Paint();
    paintIndicator.setColor(dividerColor);
    paintIndicator.setAntiAlias(true);

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }
}
 
开发者ID:wmuqing,项目名称:timePicker,代码行数:23,代码来源:WheelView.java

示例2: fitsTextIntoWidth

import android.graphics.Paint; //导入方法依赖的package包/类
private boolean fitsTextIntoWidth(final int width, final String text, final Paint paint) {
    final int maxTextWidth = width - mLanguageOnSpacebarHorizontalMargin * 2;
    paint.setTextScaleX(1.0f);
    final float textWidth = TypefaceUtils.getStringWidth(text, paint);
    if (textWidth < width) {
        return true;
    }

    final float scaleX = maxTextWidth / textWidth;
    if (scaleX < MINIMUM_XSCALE_OF_LANGUAGE_NAME) {
        return false;
    }

    paint.setTextScaleX(scaleX);
    return TypefaceUtils.getStringWidth(text, paint) < maxTextWidth;
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:17,代码来源:MainKeyboardView.java

示例3: initPaints

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaints() {
    paintOuterText = new Paint();
    paintOuterText.setAntiAlias(true);
    paintOuterText.setColor(textColorOuter);
    paintOuterText.setTypeface(typeface);
    paintOuterText.setTextSize(textSize);
    paintCenterText = new Paint();
    paintCenterText.setAntiAlias(true);
    paintCenterText.setColor(textColorCenter);
    paintCenterText.setTextScaleX(1.1F);
    paintCenterText.setTypeface(typeface);
    paintCenterText.setTextSize(textSize);
    paintIndicator = new Paint();
    paintIndicator.setAntiAlias(true);
    paintIndicator.setColor(dividerConfig.color);
    paintIndicator.setStrokeWidth(dividerConfig.thick);
    paintIndicator.setAlpha(dividerConfig.alpha);
    paintShadow = new Paint();
    paintShadow.setAntiAlias(true);
    paintShadow.setColor(dividerConfig.shadowColor);
    paintShadow.setAlpha(dividerConfig.shadowAlpha);
    setLayerType(LAYER_TYPE_SOFTWARE, null);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:24,代码来源:WheelView.java

示例4: initPaints

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaints() {
    paintOuterText = new Paint();
    paintOuterText.setColor(textColorOut);
    paintOuterText.setAntiAlias(true);
    paintOuterText.setTypeface(typeface);
    paintOuterText.setTextSize(textSize);

    paintCenterText = new Paint();
    paintCenterText.setColor(textColorCenter);
    paintCenterText.setAntiAlias(true);
    paintCenterText.setTextScaleX(1.1F);
    paintCenterText.setTypeface(typeface);
    paintCenterText.setTextSize(textSize);


    paintIndicator = new Paint();
    paintIndicator.setColor(dividerColor);
    paintIndicator.setAntiAlias(true);

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:24,代码来源:WheelView.java

示例5: drawLanguageOnSpacebar

import android.graphics.Paint; //导入方法依赖的package包/类
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) {
    final Keyboard keyboard = getKeyboard();
    if (keyboard == null) {
        return;
    }
    final int width = key.getWidth();
    final int height = key.getHeight();
    paint.setTextAlign(Align.CENTER);
    paint.setTypeface(Typeface.DEFAULT);
    paint.setTextSize(mLanguageOnSpacebarTextSize);
    final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
    // Draw language text with shadow
    final float descent = paint.descent();
    final float textHeight = -paint.ascent() + descent;
    final float baseline = height / 2 + textHeight / 2;
    if (mLanguageOnSpacebarTextShadowRadius > 0.0f) {
        paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0,
                mLanguageOnSpacebarTextShadowColor);
    } else {
        paint.clearShadowLayer();
    }
    paint.setColor(mLanguageOnSpacebarTextColor);
    paint.setAlpha(mLanguageOnSpacebarAnimAlpha);
    canvas.drawText(language, width / 2, baseline - descent, paint);
    paint.clearShadowLayer();
    paint.setTextScaleX(1.0f);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:28,代码来源:MainKeyboardView.java

示例6: getPaint

import android.graphics.Paint; //导入方法依赖的package包/类
public Paint getPaint(Context context, float scale, boolean outline) {
    float textSize = TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP,
            this.textSize,
            context.getResources().getDisplayMetrics()) * scale;

    Paint textPaint = new Paint();

    if (typeface != null) {
        textPaint.setTypeface(typeface);
    }

    textPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    textPaint.setTextSize(textSize);
    textPaint.setAntiAlias(true);

    if (outline == false) {
        textPaint.setStrokeWidth(textSize * textStrokeRatio);
        textPaint.setColor(textColor);
    } else {
        textPaint.setStrokeWidth(textSize * textStrokeRatio + textSize * textOutlineRatio);
        textPaint.setColor(outlineColor);
    }


    // skew
    textPaint.setTextSkewX(skewX);


    // scaleX
    textPaint.setTextScaleX(scaleX);

    if (Build.VERSION.SDK_INT >= 21) {
        textPaint.setLetterSpacing(letterSpacing);
    }

    return textPaint;
}
 
开发者ID:monthlypub,项目名称:SmingZZick_App,代码行数:39,代码来源:TextMakingInfo.java

示例7: _getTextPaint

import android.graphics.Paint; //导入方法依赖的package包/类
protected Paint _getTextPaint(float fontSizeScale) {
	XulRenderContext ctx = _render.getRenderContext();
	Paint defPaint = ctx.getTextPaintByName(_fontFace);

	if (!(_fontShadowSize == 0 || (_fontShadowColor & 0xFF000000) == 0)) {
		defPaint = ctx.getShadowTextPaintByName(_fontFace);
		defPaint.setShadowLayer(_fontShadowSize, _fontShadowX, _fontShadowY, _fontShadowColor);
	}

	defPaint.setColor(_fontColor);
	if (Math.abs(fontSizeScale - 1.0f) > 0.01f) {
		defPaint.setTextSize(_fontSize * fontSizeScale);
	} else {
		defPaint.setTextSize(_fontSize);
	}

	if (_fontWeight > 1.0) {
		if (_fontWeight > 2.5) {
			defPaint.setStrokeWidth(_fontWeight*fontSizeScale/2);
		} else {
			defPaint.setFakeBoldText(true);
		}
	} else {
		defPaint.setFakeBoldText(false);
	}
	defPaint.setTextScaleX(_fontScaleX);
	defPaint.setUnderlineText(_fontUnderline);
	defPaint.setStrikeThruText(_fontStrikeThrough);
	defPaint.setTextSkewX(_fontItalic ? -0.25f : 0);
	defPaint.setTextAlign(Paint.Align.LEFT);
	return defPaint;
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:33,代码来源:XulBasicTextRenderer.java


注:本文中的android.graphics.Paint.setTextScaleX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。