本文整理汇总了Java中android.graphics.Paint.setTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setTextSize方法的具体用法?Java Paint.setTextSize怎么用?Java Paint.setTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.setTextSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPaint
import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint(){
mRingPaint = new Paint();
mRingPaint.setStyle(Paint.Style.FILL);
mRingPaint.setAntiAlias(true);
mLinePaint = new Paint();
mLinePaint.setStyle(Paint.Style.STROKE);
mLinePaint.setAntiAlias(true);
mLinePaint.setColor(Color.WHITE);
mLinePaint.setStrokeWidth(4);
mTextPaint = new Paint();
mTextPaint.setTextSize(40);
mTextPaint.setColor(Color.BLACK);
mTextPaint.setAntiAlias(true);
mTextPaint.setTextAlign(Paint.Align.CENTER);
fontMetrics = mTextPaint.getFontMetrics();
mDownTextPaint = new Paint();
mDownTextPaint.setTextSize(80);
mDownTextPaint.setColor(Color.parseColor("#ff9933"));
mDownTextPaint.setAntiAlias(true);
mDownTextPaint.setTextAlign(Paint.Align.CENTER);
mDownTextPaint.setStrokeWidth(10);
mDownTextPaint.setStrokeCap(Paint.Cap.ROUND);
}
示例2: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init(String maxLengthText) {
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(1);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextSize(mIndicatorTextSize);
Rect mRect = new Rect();
mPaint.getTextBounds(maxLengthText, 0, maxLengthText.length(), mRect);
mIndicatorWidth = mRect.width() + IndicatorUtils.dp2px(mContext, 4);
int minWidth = IndicatorUtils.dp2px(mContext, 36);
if (mIndicatorWidth < minWidth) {
mIndicatorWidth = minWidth;
}
mTextHeight = mRect.height();
mIndicatorHeight = mIndicatorWidth * 1.2f;
initPath();
}
示例3: createBitmap
import android.graphics.Paint; //导入方法依赖的package包/类
private Bitmap createBitmap() {
padding_left = 0;
Bitmap bp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bp);
code = createCode();
c.drawColor(Color.rgb(DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR));
Paint paint = new Paint();
paint.setTextSize(font_size);
for (int i = 0; i < code.length(); i++) {
randomTextStyle(paint);
randomPadding();
c.drawText(code.charAt(i) + "", padding_left, padding_top, paint);
}
for (int i = 0; i < line_number; i++) {
drawLine(c, paint);
}
c.save(Canvas.ALL_SAVE_FLAG);// 保存
c.restore();//
return bp;
}
示例4: initPaint
import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint() {
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, textSize, dm);
mPaint = new Paint();
mPaint.setColor(Color.RED);
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(1);
mPaint.setTextSize(35);
mPaint.setColorFilter(new ColorFilter());
// mPaint.setStyle(Paint.Style.STROKE);
mPath = new Path();
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bg1);
bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.bg2);
bitmapShader1 = new BitmapShader(bitmap1, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
shader = new ComposeShader(bitmapShader, bitmapShader1, PorterDuff.Mode.SRC_OVER);
}
示例5: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setTextSize(48.0f);
paint.setTextAlign(Paint.Align.CENTER);
}
示例6: init
import android.graphics.Paint; //导入方法依赖的package包/类
public void init() {
mFramesCouner = 0;
mFrequency = Core.getTickFrequency();
mprevFrameTime = Core.getTickCount();
mStrfps = "";
mPaint = new Paint();
mPaint.setColor(Color.BLUE);
mPaint.setTextSize(20);
}
示例7: getWeatherIcon
import android.graphics.Paint; //导入方法依赖的package包/类
protected Bitmap getWeatherIcon(String text, Context context) {
Bitmap myBitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
Canvas myCanvas = new Canvas(myBitmap);
Paint paint = new Paint();
Typeface clock = Typeface.createFromAsset(context.getAssets(), "fonts/weather.ttf");
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTypeface(clock);
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.WHITE);
paint.setTextSize(150);
paint.setTextAlign(Paint.Align.CENTER);
myCanvas.drawText(text, 128, 180, paint);
return myBitmap;
}
示例8: getPaint
import android.graphics.Paint; //导入方法依赖的package包/类
public static Paint getPaint(Paint.Style style, int color) {
Paint mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(style);
mPaint.setColor(color);
mPaint.setTextSize(30);
return mPaint;
}
示例9: addTextWatermark
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* 添加文字水印
*
* @param src 源图片
* @param content 水印文本
* @param textSize 水印字体大小
* @param color 水印字体颜色
* @param x 起始坐标x
* @param y 起始坐标y
* @param recycle 是否回收
* @return 带有文字水印的图片
*/
public static Bitmap addTextWatermark(Bitmap src, String content, float textSize, int color, float x,
float y, boolean recycle) {
if (isEmptyBitmap(src) || content == null) return null;
Bitmap ret = src.copy(src.getConfig(), true);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Canvas canvas = new Canvas(ret);
paint.setColor(color);
paint.setTextSize(textSize);
Rect bounds = new Rect();
paint.getTextBounds(content, 0, content.length(), bounds);
canvas.drawText(content, x, y + textSize, paint);
if (recycle && !src.isRecycled()) src.recycle();
return ret;
}
示例10: BadgeDrawable
import android.graphics.Paint; //导入方法依赖的package包/类
public BadgeDrawable(Context context) {
mTextSize = 15F;
myColor = context.getResources().getColor(R.color.theme_primary_dark_badge);
mBadgePaint = new Paint();
mBadgePaint.setColor(myColor);
mBadgePaint.setAntiAlias(true);
mBadgePaint.setStyle(Paint.Style.FILL);
mTextPaint = new Paint();
mTextPaint.setColor(Color.YELLOW);
mTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
mTextPaint.setTextSize(mTextSize);
mTextPaint.setAntiAlias(true);
mTextPaint.setTextAlign(Paint.Align.CENTER);
}
示例11: getFontHeight
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* 返回字体高度
*
* @param textSize
* @return
*/
public static int getFontHeight(float textSize)
{
Paint paint = new Paint();
paint.setTextSize(textSize);
FontMetrics fm = paint.getFontMetrics();
return (int) Math.ceil(fm.descent - fm.top) + 2;
}
示例12: ThirdBezierView
import android.graphics.Paint; //导入方法依赖的package包/类
public ThirdBezierView(Context context, AttributeSet attrs) {
super(context, attrs);
mPaintBezier = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaintBezier.setStrokeWidth(8);
mPaintBezier.setStyle(Paint.Style.STROKE);
mPaintFlag = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaintBezier.setStrokeWidth(3);
mPaintBezier.setStyle(Paint.Style.STROKE);
mPaintFlagText = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaintFlagText.setStyle(Paint.Style.STROKE);
mPaintFlagText.setTextSize(20);
}
示例13: drawVerticalBar
import android.graphics.Paint; //导入方法依赖的package包/类
private void drawVerticalBar(Canvas c, Paint p)
{
p.setTextSize(getTextSize());
p.getTextBounds(COLOR_BAR_WIDTH_PATTERN, 0, COLOR_BAR_WIDTH_PATTERN.length(), tmpRect);
final int yMin = Math.min(rect.top, rect.bottom);
final int yMax = Math.max(rect.top, rect.bottom);
minMaxValues[FunctionIf.MIN] = yMin;
minMaxValues[FunctionIf.MAX] = yMax;
for (int y = yMin; y < yMax; y++)
{
p.setColor(getPaletteColor(y, minMaxValues, 255));
final int yl = yMax - (y - yMin);
c.drawLine(rect.left, yl, rect.left + tmpRect.width() - 1, yl, p);
}
}
示例14: preparePaint
import android.graphics.Paint; //导入方法依赖的package包/类
@Override
void preparePaint() {
//Set title paint
mTitlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTitlePaint.setColor(mTitleColor);
mTitlePaint.setTextAlign(Paint.Align.CENTER);
mTitlePaint.setTextSize(getContext().getResources().getDimension(R.dimen.lib_title_text_size));
}
示例15: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context) {
float unit = context.getResources().getDisplayMetrics().density;
paint = new Paint();
paint.setColor(Color.WHITE);//设置颜色
paint.setAntiAlias(true);//设置抗锯齿
paint.setTypeface(Typeface.DEFAULT_BOLD);//设置粗体字
paint.setTextSize(14 * unit);
Log.e(TAG, 14 * unit + "................");
wordsList = Arrays.asList(words);
}