當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。