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


Java TextPaint.setFlags方法代碼示例

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


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

示例1: init

import android.text.TextPaint; //導入方法依賴的package包/類
private void init(AttributeSet attrs, int defStyle) {

        setWillNotDraw(false);
        // Load attributes
        final TypedArray a = getContext().obtainStyledAttributes(
                attrs, R.styleable.FadingEdgeView, defStyle, 0);


        a.recycle();

        // Set up a default TextPaint object
        mTextPaint = new TextPaint();
        mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.setTextAlign(Paint.Align.LEFT);

        // Update TextPaint and text measurements from attributes
        invalidateTextPaintAndMeasurements();
    }
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:19,代碼來源:FadingEdgeView.java

示例2: updateMeasureState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:djuelg,項目名稱:Neuronizer,代碼行數:8,代碼來源:TypefaceSpan.java

示例3: updateDrawState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:djuelg,項目名稱:Neuronizer,代碼行數:8,代碼來源:TypefaceSpan.java

示例4: updateMeasureState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateMeasureState(TextPaint p) {
    if (mTypeface != null) {
        p.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        p.setTextSize(textSize);
    }
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:11,代碼來源:TypefaceSpan.java

示例5: updateDrawState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateDrawState(TextPaint tp) {
    if (mTypeface != null) {
        tp.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        tp.setTextSize(textSize);
    }
    if (color != 0) {
        tp.setColor(color);
    }
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:14,代碼來源:TypefaceSpan.java

示例6: init

import android.text.TextPaint; //導入方法依賴的package包/類
private void init(AttributeSet attrs, int defStyle) {
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.RoundedLetterView, defStyle, 0);

    if(a.hasValue(R.styleable.RoundedLetterView_rlv_titleText)){
        mTitleText = a.getString(R.styleable.RoundedLetterView_rlv_titleText);
    }

    mTitleColor = a.getColor(R.styleable.RoundedLetterView_rlv_titleColor,DEFAULT_TITLE_COLOR);
    mBackgroundColor = a.getColor(R.styleable.RoundedLetterView_rlv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR);

    mTitleSize = a.getDimension(R.styleable.RoundedLetterView_rlv_titleSize,DEFAULT_TITLE_SIZE);
    a.recycle();

    //Title TextPaint
    mTitleTextPaint = new TextPaint();
    mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTitleTextPaint.setTypeface(mFont);
    mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
    mTitleTextPaint.setLinearText(true);
    mTitleTextPaint.setColor(mTitleColor);
    mTitleTextPaint.setTextSize(mTitleSize);

    //Background Paint
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setColor(mBackgroundColor);

    mInnerRectF = new RectF();
}
 
開發者ID:broakenmedia,項目名稱:MultiContactPicker,代碼行數:32,代碼來源:RoundLetterView.java

示例7: updateMeasureState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateMeasureState(TextPaint p) {
	p.setTypeface(mTypeface);

	// Note: This flag is required for proper typeface rendering
	p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:8,代碼來源:TypefaceSpan.java

示例8: updateDrawState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override
public void updateDrawState(TextPaint tp) {
	tp.setTypeface(mTypeface);

	// Note: This flag is required for proper typeface rendering
	tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:8,代碼來源:TypefaceSpan.java

示例9: init

import android.text.TextPaint; //導入方法依賴的package包/類
private void init(AttributeSet attrs, int defStyle) {
        // Load attributes
//        final TypedArray a = getContext().obtainStyledAttributes(
//                attrs, FrameLayoutWithHole, defStyle, 0);
//
//
//        a.recycle();
        setWillNotDraw(false);
        // Set up a default TextPaint object
        mTextPaint = new TextPaint();
        mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.setTextAlign(Paint.Align.LEFT);

        Point size = new Point();
        size.x = mActivity.getResources().getDisplayMetrics().widthPixels;
        size.y = mActivity.getResources().getDisplayMetrics().heightPixels;

        mEraserBitmap = Bitmap.createBitmap(size.x, size.y, Bitmap.Config.ARGB_8888);
        mEraserCanvas = new Canvas(mEraserBitmap);

        mPaint = new Paint();
        mPaint.setColor(0xcc000000);
        transparentPaint = new Paint();
        transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
        transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

        mEraser = new Paint();
        mEraser.setColor(0xFFFFFFFF);
        mEraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        mEraser.setFlags(Paint.ANTI_ALIAS_FLAG);

        Log.d("tourguide","getHeight: "+ size.y);
        Log.d("tourguide","getWidth: " + size.x);

    }
 
開發者ID:AmulaySoftGroup,項目名稱:TaBeTa,代碼行數:36,代碼來源:FrameLayoutWithHole.java

示例10: addPaintFlags

import android.text.TextPaint; //導入方法依賴的package包/類
public void addPaintFlags(TextPaint paint, boolean add, int flat) {
    if (add) {
        paint.setFlags(paint.getFlags() | flat);
    } else {
        paint.setFlags(paint.getFlags() & ~flat);
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:8,代碼來源:RTextView.java

示例11: init

import android.text.TextPaint; //導入方法依賴的package包/類
private void init(AttributeSet attrs, int defStyle) {
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.ShapeLetter, defStyle, 0);

    if(a.hasValue(R.styleable.ShapeLetter_letter)){
        mTitleText = a.getString(R.styleable.ShapeLetter_letter);
    }

    mShape = a.getInteger(R.styleable.ShapeLetter_shape,DEFAULT_SHAPE);


    mTitleColor = a.getColor(R.styleable.ShapeLetter_letter_color, DEFAULT_LETTER_COLOR);
    mBackgroundColor = a.getColor(R.styleable.ShapeLetter_shape_color, DEFAULT_SHAPE_COLOR);
    mTitleSize = a.getDimension(R.styleable.ShapeLetter_letter_size, DEFAULT_LETTER_SIZE);
    a.recycle();

    //Title TextPaint
    mTitleTextPaint = new TextPaint();
    mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTitleTextPaint.setTypeface(mFont);
    mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
    mTitleTextPaint.setLinearText(true);
    mTitleTextPaint.setColor(mTitleColor);
    mTitleTextPaint.setTextSize(mTitleSize);

    //Background Paint
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setColor(mBackgroundColor);

    mInnerRectF = new RectF();
}
 
開發者ID:karanvs,項目名稱:shapeletter,代碼行數:34,代碼來源:ShapeLetter.java

示例12: updateMeasureState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override public void updateMeasureState(TextPaint p) {
	p.setTypeface(typeface);
	p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:TypefaceHelper.java

示例13: updateDrawState

import android.text.TextPaint; //導入方法依賴的package包/類
@Override public void updateDrawState(TextPaint tp) {
	tp.setTypeface(typeface);
	tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:TypefaceHelper.java

示例14: DateLineView

import android.text.TextPaint; //導入方法依賴的package包/類
public DateLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.context = context;
    //虛線
    linePaint = new Paint();
    linePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    linePaint.setStyle(Paint.Style.STROKE);
    linePaint.setColor(Color.WHITE);
    linePaint.setStrokeWidth(3);
    DashPathEffect effect = new DashPathEffect(new float[]{8, 8}, 0);
    linePaint.setPathEffect(effect);

    //文本
    textPaint = new TextPaint();
    textPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    textPaint.setTextSize(DensityUtils.sp2px(context, 10));
    textPaint.setColor(Color.WHITE);

    //圓點
    circlePaint = new Paint();
    circlePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint.setColor(Color.WHITE);

    timeAxisList = new ArrayList<>();
    TimeAxis day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("端午");
    day.setDays(0);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("畢業");
    day.setDays(10);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("實習");
    day.setDays(11);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("暑假");
    day.setDays(17);
    timeAxisList.add(day);
}
 
開發者ID:NICOLITE,項目名稱:HutHelper,代碼行數:47,代碼來源:DateLineView.java


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