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


Java TextPaint.setAntiAlias方法代码示例

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


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

示例1: drawCenterMultiText1

import android.text.TextPaint; //导入方法依赖的package包/类
/**
 * 绘制多行居中文本(方式1)
 *
 * @param canvas 画布
 */
private void drawCenterMultiText1(Canvas canvas) {
    String text = "ABC";

    // 画笔
    TextPaint textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setColor(Color.GRAY);

    // 设置宽度超过50dp时换行
    StaticLayout staticLayout = new StaticLayout(text, textPaint, dp2px(50),
            Layout.Alignment.ALIGN_CENTER, 1, 0, false);
    canvas.save();
    // StaticLayout默认从(0,0)点开始绘制
    // 如果需要调整位置,只能在绘制之前移动Canvas的起始坐标
    canvas.translate(-staticLayout.getWidth() / 2, -staticLayout.getHeight() / 2);
    staticLayout.draw(canvas);
    canvas.restore();
}
 
开发者ID:alidili,项目名称:Demos,代码行数:24,代码来源:CustomTextView.java

示例2: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {
    //绘制提示的画笔
    mTipPaint = new Paint();
    mTipPaint.setColor(mPageView.getTextColor());
    mTipPaint.setTextAlign(Paint.Align.LEFT);//绘制的起始点
    mTipPaint.setTextSize(ScreenUtils.spToPx(mContext, DEFAULT_TIP_SIZE));//Tip默认的字体大小
    mTipPaint.setAntiAlias(true);
    mTipPaint.setSubpixelText(true);

    //绘制页面内容的画笔
    mTextPaint = new TextPaint();
    mTextPaint.setColor(mPageView.getTextColor());
    mTextPaint.setTextSize(mPageView.getTextSize());
    mTextPaint.setAntiAlias(true);

    mBgPaint = new Paint();
    mBgPaint.setColor(mPageView.getPageBackground());

    mBatteryPaint = new Paint();
    mBatteryPaint.setAntiAlias(true);
    mBatteryPaint.setDither(true);
    mBatteryPaint.setColor(mPageView.getTextColor());

}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:25,代码来源:PageLoader.java

示例3: TMReminderTagsView

import android.text.TextPaint; //导入方法依赖的package包/类
public TMReminderTagsView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    if (mDensity == -1) {
        initWith(context);
    }
    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setColor(Color.rgb(255, 59, 68));
    textPaint.setTextSize(dp2px(10));

    bgPaint = new Paint();
    bgPaint.setColor(Color.rgb(250, 211, 213));

    tagsGap = dp2px(7);

    hPadding = dp2px(3);

    tagRect = new Rect();

    textFontMetrics = textPaint.getFontMetrics();
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:22,代码来源:TMReminderTagsView.java

示例4: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(getTextSize());
    mTextPaint.setColor(mColor);
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setTypeface(getTypeface());

    mTextPaintOutline = new TextPaint();
    mTextPaintOutline.setAntiAlias(true);
    mTextPaintOutline.setTextSize(getTextSize());
    mTextPaintOutline.setColor(mBorderColor);
    mTextPaintOutline.setStyle(Paint.Style.STROKE);
    mTextPaintOutline.setTypeface(getTypeface());
    mTextPaintOutline.setStrokeWidth(mBorderSize);
  }
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:18,代码来源:OutlineTextView.java

示例5: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
开发者ID:Leavessilent,项目名称:QuanMinTV,代码行数:17,代码来源:OutlineTextView.java

示例6: init

import android.text.TextPaint; //导入方法依赖的package包/类
private void init() {
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    if (mTextSizePx <= 0) {
        mTextSizePx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
                DEFAULT_FONT_SIZE_SP, getResources().getDisplayMetrics());
    }
    mTextPaint.setTextSize(mTextSizePx);
    mTextPaint.setColor(mTextColor);
    mTypeface = MongolFont.get(MongolFont.QAGAN, mContext);
    mTextPaint.setTypeface(mTypeface);
    mRenderer = MongolCode.INSTANCE;
    if (mUnicodeText == null) {
        mUnicodeText = "";
    }
    mGlyphText = mRenderer.unicodeToMenksoft(mUnicodeText);
}
 
开发者ID:suragch,项目名称:mongol-library,代码行数:18,代码来源:MongolLabel.java

示例7: init

import android.text.TextPaint; //导入方法依赖的package包/类
private void init() {
    bgPaint = new Paint();
    bgPaint.setAntiAlias(true);
    bgPaint.setStyle(Paint.Style.FILL);
    bgPaint.setColor(bgColor);
    bgPaint.setStrokeWidth(lineBgWidth);

    proPaint = new Paint();
    proPaint.setAntiAlias(true);
    proPaint.setStyle(Paint.Style.FILL);
    proPaint.setColor(proColor);
    proPaint.setStrokeWidth(lineProWidth);

    textPaint = new TextPaint();
    textPaint.setTextSize(textsize);
    textPaint.setAntiAlias(true);
}
 
开发者ID:JJS-CN,项目名称:JBase,代码行数:18,代码来源:FlowViewVertical.java

示例8: getTextPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private TextPaint getTextPaint() {
	TextPaint textPaint = new TextPaint();
	textPaint.setColor(this.textColor);
       textPaint.linkColor = this.textColor;
	textPaint.setAntiAlias(true);
	textPaint.setTextSize(this.textSize);
	textPaint.setTypeface(this.typeFace);

	return textPaint;
}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:11,代码来源:TableHandler.java

示例9: textPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private TextPaint textPaint() {
    final TextPaint paint = new TextPaint();
    paint.setColor(Color.BLACK);
    paint.setAntiAlias(true);
    paint.setTextSize(24);
    paint.setTextAlign(Paint.Align.CENTER);
    return paint;
}
 
开发者ID:lidong1665,项目名称:AndroidPDF,代码行数:9,代码来源:Page.java

示例10: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint()
{
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextAlign(Paint.Align.LEFT);
}
 
开发者ID:codeccc,项目名称:baselibrary-master,代码行数:9,代码来源:AutoWrapTextView.java

示例11: NineGridViewWrapper

import android.text.TextPaint; //导入方法依赖的package包/类
public NineGridViewWrapper(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    //转化单位
    textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, textSize, getContext().getResources().getDisplayMetrics());

    textPaint = new TextPaint();
    textPaint.setTextAlign(Paint.Align.CENTER);  //文字居中对齐
    textPaint.setAntiAlias(true);                //抗锯齿
    textPaint.setTextSize(textSize);             //设置文字大小
    textPaint.setColor(textColor);               //设置文字颜色
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:13,代码来源:NineGridViewWrapper.java

示例12: initPainters

import android.text.TextPaint; //导入方法依赖的package包/类
protected void initPainters() {
    textPaint = new TextPaint();
    textPaint.setColor(textColor);
    textPaint.setTextSize(textSize);
    textPaint.setAntiAlias(true);

    paint.setAntiAlias(true);
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:9,代码来源:CircleProgress.java

示例13: createTextLayout

import android.text.TextPaint; //导入方法依赖的package包/类
private StaticLayout createTextLayout(String text, int color, float fontSize, int width) {
    TextPaint paint = new TextPaint();
    paint.setColor(color);
    paint.setTextSize(fontSize);
    paint.setTypeface(Typeface.SANS_SERIF);
    paint.setAntiAlias(true);

    return (new StaticLayout(text, paint, width, Layout.Alignment.ALIGN_CENTER, 1.1f, 0f, true));
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:10,代码来源:ArtworkFactory.java

示例14: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {
    mValuePaint = new TextPaint();
    mValuePaint.setAntiAlias(antiAlias);
    mValuePaint.setTextSize(mValueSize);
    mValuePaint.setColor(mValueColor);
    mValuePaint.setTypeface(Typeface.DEFAULT_BOLD);
    mValuePaint.setTextAlign(Paint.Align.CENTER);

    mUnitPaint = new TextPaint();
    mUnitPaint.setAntiAlias(antiAlias);
    mUnitPaint.setTextSize(mUnitSize);
    mUnitPaint.setColor(mUnitColor);
    mUnitPaint.setTextAlign(Paint.Align.CENTER);

    mArcPaint = new Paint();
    mArcPaint.setAntiAlias(antiAlias);
    mArcPaint.setStyle(Paint.Style.STROKE);
    mArcPaint.setStrokeWidth(mArcWidth);
    mArcPaint.setStrokeCap(Paint.Cap.ROUND);

    mBgArcPaint = new Paint();
    mBgArcPaint.setAntiAlias(antiAlias);
    mBgArcPaint.setColor(mBgArcColor);
    mBgArcPaint.setStyle(Paint.Style.STROKE);
    mBgArcPaint.setStrokeWidth(mBgArcWidth);
    mBgArcPaint.setStrokeCap(Paint.Cap.ROUND);

    mDialPaint = new Paint();
    mDialPaint.setAntiAlias(antiAlias);
    mDialPaint.setColor(mDialColor);
    mDialPaint.setStrokeWidth(mDialWidth);
}
 
开发者ID:lpy19930103,项目名称:AndroidPedometer,代码行数:33,代码来源:StepProgress.java

示例15: init

import android.text.TextPaint; //导入方法依赖的package包/类
private void init() {
    float dSize = TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_SP,
            15,
            getContext().getResources().getDisplayMetrics());
    tBuilder = new StringBuilder("");
    setText("");
    mTpaint = new TextPaint();
    mTpaint.setColor(Color.BLUE);
    mTpaint.setAntiAlias(true);
    mTpaint.setTextSize(dSize);
    mTpaint.setStyle(Paint.Style.FILL);
    tRect = new Rect();
    setWillNotDraw(false);
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setFilterBitmap(true);
    camera = new Camera();
    matrix = new Matrix();
    mPath = new Path();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mViewOutlineProvider = new ViewOutlineProvider() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void getOutline(View view, Outline outline) {
                if (mPath.isConvex()) outline.setConvexPath(mPath);
            }
        };

    }
}
 
开发者ID:YoneHsiung,项目名称:WavePullLayout,代码行数:33,代码来源:HeaderLayout.java


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