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


Java Paint.SUBPIXEL_TEXT_FLAG屬性代碼示例

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


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

示例1: GifBadge

GifBadge(Context context) {
    if (bitmap == null) {
        final DisplayMetrics dm = context.getResources().getDisplayMetrics();
        final float density = dm.density;
        final float scaledDensity = dm.scaledDensity;
        final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint
                .SUBPIXEL_TEXT_FLAG);
        textPaint.setTypeface(Typeface.create(TYPEFACE, TYPEFACE_STYLE));
        textPaint.setTextSize(TEXT_SIZE * scaledDensity);

        final float padding = PADDING * density;
        final float cornerRadius = CORNER_RADIUS * density;
        final Rect textBounds = new Rect();
        textPaint.getTextBounds(GIF, 0, GIF.length(), textBounds);
        height = (int) (padding + textBounds.height() + padding);
        width = (int) (padding + textBounds.width() + padding);
        bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        bitmap.setHasAlpha(true);
        final Canvas canvas = new Canvas(bitmap);
        final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        backgroundPaint.setColor(BACKGROUND_COLOR);
        canvas.drawRoundRect(0, 0, width, height, cornerRadius, cornerRadius,
                backgroundPaint);
        // punch out the word 'GIF', leaving transparency
        textPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        canvas.drawText(GIF, padding, height - padding, textPaint);
    }
    paint = new Paint();
}
 
開發者ID:gejiaheng,項目名稱:Protein,代碼行數:29,代碼來源:BadgedFourThreeImageView.java

示例2: QMUICollapsingTextHelper

public QMUICollapsingTextHelper(View view) {
    mView = view;

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    mCollapsedBounds = new Rect();
    mExpandedBounds = new Rect();
    mCurrentBounds = new RectF();
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:9,代碼來源:QMUICollapsingTextHelper.java

示例3: CollapsingTextHelper

public CollapsingTextHelper(View view) {
  mView = view;

  mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

  mCollapsedBounds = new Rect();
  mExpandedBounds = new Rect();
  mCurrentBounds = new RectF();
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:9,代碼來源:CollapsingTextHelper.java

示例4: StaticLabelTextInputLayout

public StaticLabelTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(getTypeface());
    mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material));
    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context,
            new int[] { android.R.attr.textColorHint });
    mTextColorUnfocused = ta.getColor(android.R.attr.textColorHint, 0);
    ta.recycle();
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused);
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:13,代碼來源:StaticLabelTextInputLayout.java

示例5: LabelLayout

public LabelLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);
    setAddStatesFromChildren(true);

    mInputFrame = new FrameLayout(context);
    mInputFrame.setAddStatesFromChildren(true);
    super.addView(mInputFrame, -1, generateDefaultLayoutParams());

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(Typeface.DEFAULT);// getTypeface());
    mTextSizeCollapsed = getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material);
    mTextSizeExpanded = getResources().getDimensionPixelSize(R.dimen.abc_text_size_medium_material);
    mTextPaint.setTextSize(mTextSizeCollapsed);

    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context, attrs,
            new int[] { R.attr.doNotExpand, android.R.attr.hint, android.R.attr.textColorHint });
    try {
        mDoNotExpand = ta.getBoolean(R.attr.doNotExpand, false);
        mHint = ta.getString(android.R.attr.hint);
        mTextColorUnfocused = ta.getColorStateList(android.R.attr.textColorHint);
    } finally {
        ta.recycle();
    }
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused.getColorForState(getDrawableState(), mTextColorUnfocused.getDefaultColor()));

    mAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setDuration(200);
    mAnimator.addUpdateListener((ValueAnimator animation) -> {
        mAnimState = (float) animation.getAnimatedValue();
        invalidate();
    });

    updateTopMargin();
    updateTextPositions();
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:39,代碼來源:LabelLayout.java

示例6: setTypeface

public final void setTypeface(TextView target, Typeface t) {
    if (t == null) return;
    int flags = target.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG;
    target.setPaintFlags(flags);
    target.setTypeface(t);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:MaterialDialog.java


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